6 ms·
I'm primarily a C# dev, but I find Go quite interesting. Any recommendations for how I can get started and reap some benefits, given my background?
by GordonS 6y ago
I'm primarily a C# dev, but I find Go quite interesting. Any recommendations for how I can get started and reap some benefits, given my background?
- throwaway894345 6y agoI got started with the Go tour: https://tour.golang.org https://tour.golang.org You'll get a feel for the language constructs. Once you're ready to graduate to tinkering with your own stuff, then go install Go: https://golang.org/doc/install https://golang.org/doc/install Some noted differences from C# (my C# knowledge is 5-10 years out of date, mind you): * Go is a much simpler language; it lacks classes, inheritance, generics, exceptions, etc--you can be productive in a weekend, conservatively * Go has a formatter that everyone uses, so everyone's code has the same style * Go lacks generics, so everyone generally writes in the same imperative way (few personal, creative flourishes)--it's very boring in this regard (which is a feature for many people) * Go has value types (like C#) but they are much more idiomatic--it also has pointers and other reference types * Go's interfaces are implicitly satisfied, which is like statically-typed duck typing if you're familiar with any dynamic languages (no need to write `extends IFoo` or whatever, unlike C#) * Go statically compiles everything by default (the "VM" is compiled into every individual program) so you can just pass around a single compiled artifact * Go has lightweight threads ("goroutines") * For web service things, you don't need a Netty or any other web-server in front of your service; the web server is just a library (part of the standard library, in fact) and it is production-grade Go and C# occupy the same ballpark in terms of performance.
- throwaway894345 6y agoOof, sorry for the formatting. Missed the edit window. One last characterization: Go is like C with a GC, package management(and other sane tooling), and many other rough edges removed.
- lanstin 6y agoPlus an awesome multi-core solution.
- throwaway894345 6y agoPretty sure .Net does fine with multicore, or at least to the extent that it doesn't, it's down to excessive sharing/mutation resulting from OO design patterns (modulo "that's not True OO!" arguments, anyway).
- y-c-o-m-b 6y agoI'm a full-stack .NET dev that did a brief stint at iStreamPlanet - a streaming media company - where I got my first exposure to Go. I was actually surprised when they hired me with absolutely zero knowledge in Go. That said, I was able to hit the ground running with minimal assistance using the language itself and I found Go to be enjoyable. Don't let the unfamiliar territory intimidate you. "A Tour of Go" was a perfect starting point: https://tour.golang.org/welcome/1 https://tour.golang.org/welcome/1 You raised an interesting point in your question though: how do you reap benefits? I did not find a good answer to this. I've yet to see any convincing real-world reason to switch from .NET Core to Go. I thought perhaps it had an edge in the streaming media industry, but I didn't find that argument to hold significant weight either. If you go searching online, you might find some articles that show Go to be more performant using large numbers of threads or doing exclusively mathematical operations, so that might be where you could reap some benefits? EDIT: I hope what I said about reaping benefits doesn't come off as any sort of fanboy-ism towards a specific language. This is just my personal experience as C# dev. Use the language that's right for you and right for the task.
- GordonS 6y agoAppreciate the input from someone who has gone .NET -> Go! I wasn't sure if there were any obvious benefits, but from looking at various Go codebases recently, they usually seem so succinct by comparison to the typical C# codebase I see - I love C#, but that has piqued my interest. Also, I don't try new languages often, so might be interesting just to have a go (yes, pun intended :)