Talking Unit Testing

I’m interviewed by my old friend J. Tower (of Trailhead Technology Partners) on his Blue Blazes YouTube program, talking about Unit Testing. Lots of fun discussing an important topic. Tune in here.

Posted in Testing | Leave a comment

APIs in .NET – Part 2 – The Database

As noted in part 1 of this series, I will be building an application specifically to explore building APIs. To get started, I’ll want to build a back-end database. The application we’ll be simulating is a car dealership. Customers can list a car for sale, or look through cars they might buy.

We want to keep things very simple, so we will create a single table for now: Car

Car will have six columns

  • id (int primary key)
  • make (varchar 50)
  • model (varchar 50)
  • model_year (int)
  • price (decimal)
  • deleted (int)

By marking id as primary key you ensure two things: no two cars will have the same id, and each added row will have an incremented value. The deleted column allows us to have “soft” deletes — that is, we mark a row deleted but do not remove it from the table.

We can now insert a few rows:

insert into car
(make, model, model_year, price, deleted)
values ('Subaru', 'Imprezza', 2024 ,35500, 0),
('Subaru','Outback',2024,42000, 0),
('Prius','C',2022,25000, 0)

Note: I highly recommend the book SQL Pocket Guide (O’Reilly, Alice Zhao) for looking up how to do all the SQL operations I’ll show in these blog entries.

With this table, we can create endpoints for the CRUD (Create Read Update Delete) operations and more (e.g., obtaining a list of available vehicles).

In the next post, we’ll build our first endpoint to get a list of available cars.

Posted in API, Essentials | 1 Comment

New Series: Creating APIs in .NET

While I’m still happily ensconced at CNH Industrial, I have changed my job. I’m no longer writing mobile applications (for the first time in about 7 years!) but rather am writing APIs using ASP.NET Core and C#. -The plan is to have a book on creating APIs (how-to, best practices, patterns, etc.) next year. In the interim, I’ll be writing a series of blog posts covering such topics as how to get started, software and tools you’ll need, REST, and much more.

As part of this series, I’ll create a dead-simple real-world example of a car selling and buying application, suggested by Daniel Brevitt (technical editor of .NET MAUI For C# Programmers). This application will consist of four major parts:

  • The backend SQL Server database
  • The front end for administrators (for inventory, etc.)
  • The front end for customers (for buying or selling)
  • The API that connects the front end to the back end

We’ll create a very simple SQL database using SQL Server and SSMS, and take advantage of Dapper: a simple ORM (Object Relational Model). We will not cover Entity Framework as our focus will be on the APIs, not the back end.

Similarly, the front end will be a very simple application — though at first I’ll simply use Postman rather than building out the front end. In fact, given how important and powerful Postman is, I may never get around to building a real front-end. Getting familiar with the Postman is more important for our purposes.

We will build three types of APIs

  • Traditional APIs built using controllers in ASP.NET Core and .NET 7/8
  • Minimal APIs
  • Azure Functions

My focus in the first posts will be on the first two types, so that we can work locally without having to use Azure for now (there are tools for working with Azure functions locally, but we’ll hold off on that). In fact, we’ll create such a simple database that you can recreate it locally (and I’ll put all the code for this series up on GitHub).

For these posts, I anticipate developing on Windows using:

  • Visual Studio 2022
  • C# – probably nothing more advanced than C# 7 or 8, though bits of later versions may appear from time to time
  • SQL Server (latest)
  • SQL Server Management Studio (SSMS) that comes with SQL Server
  • Postman (latest)
  • Dapper (latest)
  • AutoMapper

All of the software we’ll be using is free (the community editions are fine).

In the next post I’ll create the database and its preliminary tables.

Posted in API, Essentials | Leave a comment

11th MVP award

Pleased and proud to have been awarded my 11th MVP award from Microsoft.

Posted in Microsoft | Leave a comment

Hey! I was interviewed on WebRush

I had the pleasure of turning the tables and being interviewed on WebRush with Jon Papa et al

https://www.webrush.io/episodes/episode-240-theres-something-net-maui-with-jesse-liberty

Posted in Essentials | Leave a comment

Writing a programmer’s cover letter: ChatGPT

https://www.packtpub.com/article-hub/writing-a-customized-cover-letter-for-a-specific-job-in-minutes-using-chatgpt

Posted in Essentials | Leave a comment

Yet Another Podcast – De Sanctis on APIs

Today I spoke with Valerio De Sanctis, author of Building Web APIs with ASP.NET Core.

Posted in Essentials | Tagged | Leave a comment

Writing Unit Tests with ChatGPT

Just posted on Packt: Writing Unit Tests with ChatGPT

Posted in Essentials | Leave a comment

About that dozen programmer must-haves

I wrote this blog post in September of last year, and looking at it today I realized that I don’t use a couple of these anymore:

1) Resharper: the overhead was borderline too much and most of the refactoring power I used is now cooked into Visual Studio

2) Beyond Compare: never did get the hang of using this for git conflicts. Still searching for the right thing

3) OneNote – lost a lot of data with this and switched back to Evernote. Very happy with the change.

Finally, I still use Git Copilot but would move it to the top of the list. Integrated with Intellisense, it is by far the biggest productivity booster I know of. Can’t wait for CoPilot X!

Posted in Essentials | Leave a comment

New Job!

I have changed jobs within my current company (CNH Industrial). I will no longer be doing mobile programming (for the first time in six years) and will be building APIs and back-end code!

I think you can expect fewer articles on mobile/ .NET MAUI programming, and more on ASP.NET Core, Azure Functions, APIs, Architecture, Microservices, etc.

I’m also scoping out writing a book which may include the following topics:

  • Creating the back end (SQL Server & SQL)
  • Azure (Docker, Azure Functions) & Localhost
  • Designing and creating the Minimal API (architecture, end points, etc)
  • Creating the front end ( .NET MAUI )

The book would assume only that you have some C# experience. We’d also cover tools, setup, and best practices. All of this would be in the context of a non-trivial application.

I’d be very interested in hearing your thoughts on such a book. Please feel free to send me email at jesseliberty@gmail.com.

Posted in Essentials | Leave a comment

.NET MAUI Videos Free

I’ve posted my .NET MAUI For Xamarin.Forms Programmers and Advanced .NET MAUI videos on YouTube.

Posted in .NET MAUI | Tagged , , , | Leave a comment

Prague Comes To Boston

I’ll be presenting at Boston Code Camp on

  • .NET MAUI For Xamarin.Forms Developers
  • Advanced .NET MAUI

This is a free, one-day event on Saturday, April 29, in Burlington, MA.

Posted in .NET MAUI | Leave a comment