Why do I struggle with GoLang? I mean it should be simple right? Yet coding in it didn't quite fit my mental framing. I struggled with understanding this then I realised - I like beautiful code.
I've been doing js for a long time now. I got into functional programming, 'declarative' paradigms etc. The code became graceful. Beautiful. It became a pleasure to read it. With Go the syntax, at least for me, seems to come from the Brutalism movement. Some duplication of code is considered OK, like anonymous structs etc. Maps and structs, lots of if err != nil
noise, no .map
or .reduce
but instead lots of for
loops.
The huge functions - scores of lines long are all too common. I like to think a function does one thing and one thing well. Then these functions can be aggregated into a parent function, so the code becomes easy to read. Uncle Bob and Grady Booch said that code should read like well written prose. I totally agree with this. Maybe the next step is code should read like poetry?