Golang, it was love at first sight

A 4 minutes story written on Aug 2017 by Adrian B.G.

image

When I hear “Go” I always have this flash…back.

Intro

Usually, when people have free time they do some R&R, but me, being weird and all I like to learn, experiment and play with new things. I have enough new hobbies (earlier this year I learned to pick locks & started to do mobile photography), so I decided to step up my lost programming mojo.

If {you are like me (web or mobile developer, avoided low-level languages and concurrency for any reason) keep reading, else you already know the truth, skip to the end and share the article 😁.}

I was away from the Web development for a couple of years, doing Unity3D (C#) & mobile, so naturally I began to catch up with the latest web trends. I made some small projects using MeteorJS (node +hot code +~mongodb + other steroids), React and D3JS. By switching to nodeJS I ditched PHP, working in only 1 language, with shared code, I greatly improved my productivity.

Go — the programming language

Reading about new architectural styles, scalability & cloud I found a pattern, most of the big companies (www backbone) switched in a way or another to Go.

When reading about it I found that we had a lot in common (me & Go), it’s a good start for any relationship.

image
  • We are both very opinionated
  • We like to work with JavaScript (building an API is easy or they can be complementary)
  • We deeply care about developer productivity
  • We like KISS. Simple is better (vs cpp)
  • 1 way to do it (idioms, code formatting). Having more ways complicates the project, the developer’s brain, team work and compiler’s life.
  • We suck at RegEx (but the contributors are working on it)
  • We hate bugs (so we enforce coding rules)
  • We like to [multi task] (https://tour.golang.org/concurrency/1)and work with big data.
image

For me Golang has a few more advantages:

  • It is the perfect mix between low & high-level languages. I want to deliver fast, get things done, so taking out the garbage is not for me. The steep learning curve keeps me away from low-level.
  • It has integrated Unit Tests— I was looking for a reason to start practicing TDD.
  • Community— after more than 60 hours of conferences panels and reading forums I can say it is a nice community.
  • I want to be more involved in the open source community, this is my Go sign.
  • It has identity & a cool mascot
  • It creates a pleasant environment (good tools, compiler warnings, idioms etc).
  • WebAssembly Learning a compiled language will help to gain an advantage & have fun writing JavaScript and WebAssembly modules in the same time.
image

Most of the “anti” Go reasons I consider them to be “pro” reasons, here are a few examples :

  • missing features like Exceptions- results in better code, who wants this chaos on this hands?.
  • “When 2 sides argue more than 15 min they are both wrong.” In this case wars took more than a decade, so Go being opinionated is a good thing. No more spaces vs tabs, functions vs objects, for vs while … Developers write the same code, compiler can optimize it better.
  • overloading— usually creates too much similar code, and there is no polymorphism, so no much use for it when you code in Go style. Overloading makes “cool looking code”, but is harder to debug, maintain and interpret. I think interfaces are enough (1 function does 1 thing, that can be relate to 1 interface) with explicit conversions.
image
Actual c++ code
  • code is art / has no soul — I think the beauty is not in the source formatting, rather at the system/architecture level, solving difficult problems with simple solutions.
  • most of the reasons can be easily ignored: they are too subjective, don’t understand the Go paradigms, their minds are stuck in OOP never land or they compare it with other languages like C/C++ (which is not an alternative for) or apply to problems outside of the scope of Go.

If {you want to be a better programmer by practicing katas check CodeWars}

Go learned from 30 yrs of development mistakes

There, I said it! It went back to the roots and returned like a Pheonix, better and with a fresh look.

I spent too many hours of my life debugging and fixing bugs. I remember a lot of fixes, mistakes and anti-patterns that I fixed along the years, and a lot of them are addressed in the compiler rules and coding style of Go.

Most programmers are humans, we have feelings and bad days, different experiences and backgrounds, different level of professionalism, technology/env evolves around the code. Bad code will always exists, but if the Language we speak (Go) can fix a lot of issues (even before they exists), shall it be!

If {you want to learn Go check out my first steps:} First steps in learning Golang

image

Done, rant over, thanks for reading!

Thanks to ashleymcnamara, her gopher panel inspired me to start contributing.

Thanks! 🤝

Please share the article, subscribe or send me your feedback so I can improve the following posts!

comments powered by Disqus