Aaron Saikovski
Posted on January 8, 2024
Hello everyone, this is my first post for 2024 and I hope you all had a great break.
Over the break I was thinking about some of the technologies I wanted to sink my teeth into in 2024.
The main two I will be focussing on are .Net Core 8 and Go.
For a full stack platform .Net/.Net Core is hard to beat and for pure backend API development you really can't beat Go.
When I was looking at some key features for any API development in .Net Core and Go I came up with this list that I thought I would share:
I have broken this down into a .Net Core Web API Vs. Go list with supporting links.
Native compilation or as close to native compiled - Go Wins here. Although .Net 8 has AOT (Ahead of Time) compilation but not all libraries are supported. More info can be found here.
Boilerplate/Starter templates - I have two projects to help get you started here :-). Go API Starter and .Net Minimal API Starter.
Web Framework - Both support a rich web framework, but .Net core wins here from a full stack perspective. But from a pure speed and performance perspective GoLang wins, using the Fibre framework is unbeatable.
Clean architecture - Both support this.
Clean Architecture In ASP.NET Core Web API
Go Backend Clean ArchitectureLogging - Both support this but its important to ensure that any logging framework supports a zero allocation model. For .Net use Serilog and for GoLang use Zerolog.
gRPC - Both support this.
Overview for gRPC on .NET
gRPC-GoDocker/Containers - Both support this. Although .Net 8 has a much richer Docker integration (you can remove Docker files altogether) but the .Net docker image size is about 4 times larger. From a size and speed perspective GoLang wins here.
Creating a Minimal API with Docker
Containerize a .NET app with dotnet publish (new way..No Docker file)
Containerize the go language REST API using DockerRate Limiting - Both support this but can be tricky to implement and depends on the algorithm used.
Rate limiting middleware in ASP.NET Core
Rate Limiting API Calls in GoProfiling - Both support this.
How to Use Mini Profiler in ASP.NET Core Web API
Golang Profiling: The Basics and a Quick TutorialGithub Actions - Both support this.
How To Build a CI/CD Pipeline With GitHub Actions And .NET
GitHub Actions workflow for Go Continuous IntegrationDatabases/ORM- Both support this but have different implementations.
API Development Using Dapper and Microsoft Asp.NET Core Web API
Entity Framework
GORM (ORM library for Golang)
SQLBoiler (database-first ORM)
XORM (Simple and Powerful ORM for Go)Tracing - Both support this.
Tracing in ASP.Net Web API
Tracing runtime activities in Go.Exceptions - .Net has the more traditional exception handling approach whereas Go has error return/nil types.
How to handle errors in Minimal API apps
Error Handling in Go REST APIsHealth Checks - Both support this.
Health Checks In ASP.NET Core For Monitoring Your Applications
Healthcheck (RESTful Healthcheck API implementation for Go services)Unit tests - Both support this.
How to test your C# Web API
Testify
Testing REST APIs in GoEndpoint Grouping - Both support this.
Minimal APIs quick reference (Route Groups)
EndPoint Grouping .Net
Go Fiber – Route Groups
Fiber Framework in GolangAPI Key security - Both support this and have very similar implementations.
Implement API Key Authentication in ASP.NET Core
KeyAuth in Go FiberAPI Versioning - Both support this.
.Net MinimalApiExample
Go Fiber Versioning BoilerplateAuthentication & Authorization (JWT) - Both support this but depends on your use case and what you are authenticating against. JWT links are provided here:
How to implement JWT authentication in ASP.NET Core
jwt-go
So from the comparison above hopefully this will guide you in your decision. For pure speed and lightweight APIS with no startup delays, I recommend Go.
But .Net 8 isnt no slouch either and is a very close second. Very close. If you are after a rich and mature ecosystem and really amazing tooling, go with ASP.Net 8 Core.
thanks!
Posted on January 8, 2024
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.