Go from a C# Developer’s Perspective

Premier Developer

Premier

In this post, App Dev Manager Vishal Saroopchand reflects on learning Go coming from a C# development background.


This post is intended to help C# developers embrace Go by showing the two languages are not that far apart in terms of key concepts, patterns and style. At first glance, they do appear to be considerably different. In reality, the most challenging part of learning Go as a C# developer, was learning all the stylistic differences, the implicitness and a composition-first approach to solving problems – it was not the syntax.

Unfortunately, those key challenges I listed above are only overcome by experience with the language. However, I do want to show from a syntax standpoint and general techniques around threading, exceptions, data types, type conversions, etc. are easily to grasp.

First, let’s talk about why you should learn Go. As a cloud developer, I increasingly encounter projects that involves Go. Azure services such as AKS, Blockchain, Terraform, and supporting technologies such as Helm are all heavily Go. In addition, Go is a first-class citizen on Azure as all core PaaS SDKs offer Go libraries.

For me, it was important to parse through these open source projects to learn how they are implemented to speed up my own learning. As a result, I started learning Go roughly 11 months ago. I can honestly say I have enjoyed every minute of it. To help accelerate my learning, I started contribution to Go-Cloud, a multi-cloud abstraction library, by wrapping key Azure services such as Azure Blob Storage, Service Bus, KeyVault and Azure Database for MySQL. Learning from the Go-Cloud contributors was the most important part of my learning journey. It helped me grasp “go-way” of solving problems and code style.

Now, let’s look at a side by side comparison on some of the key features (Go on the left, C# on the right):

See C# Docs for contrast and deeper explanation.

https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/inheritance

See C# Docs for contrast and deeper explanation.

https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/passing-reference-type-parameters

References:

Premier Developer
Premier Developer

Premier Support for Developers

Follow Premier   

1 comment

  • Joshua Ryder
    Joshua Ryder

    Hi. Thank you for spending time to write this post. Any chance you can get back and redo the screenshots. Many of them are so small that I can’t really see them, making it really hard to compare the code. 🙂

Leave a comment