Live data from Hacker News

Why Go is my favorite programming language

michael.stapelberg.de

111–120 of 256 posts

Re: Why Go is my favorite programming language

#111
When Java was first introduced, the world was abuzz about this cool new language which you could "write once, run anywhere". It took some time, but as it grew in popularity, articles started appearing about how much Java sucked because it was slow and bloated, required a ton of boilerplate code, and eventually because "write once, run anywhere" turned out to be a myth, along with a boatload of other reasons. The honeymoon wore off, and legions of Java-haters were born.

Perl suffered a similar fate. When it came out unix was just surging in popularity with the internet boom and a lot of people were thrilled to have a single language you could learn which combined the features of common command-line tools like sed and awk, and that was a "real programming language" that was more powerful than shell scripting, and which grew to have a ton of useful libraries in the form of CPAN. Years later, and Python and Ruby started getting popular, the "Perl sucks!" mantra sprang up and the once-mighty Perl shrank before the upstarts.

Ruby and Python are getting their turn now, and I'm starting to see some people expressing hate towards them as well, though it hasn't quite reached the pervasiveness of Java and Perl hate yet.

Go was next. People were excited about this cool new language from Google, a place filled with great engineers, and from the mind of Rob Pike, of Unix and Plan 9 fame. It was supposed to be like a simpler and more elegant form of C. What's not to like. Well, the replies to this post are showing that for some the honeymoon is already over.

Other languages had their day in the limelight, only to wind up being hated: C++, Lisp, Fortran, Cobol, HTML, Javascript.

Bjarne Stroustrup observed that "there are two types of languages, the ones everyone complains about, and the ones nobody uses."

Whenever some shiny new language comes out, promising to solve everyone's problems in some domain, and people start jumping on the bandwagon and singing its praises to high heaven (which seems to happen ever couple of years), I try to take a deep breath and step back. There will likely come a day, before too long, when they too will be subject to hatred and scorn, just as all the other popular languages before them.

Re: Why Go is my favorite programming language

#112
I know a guy who used to teach Haskell at a university who now runs a development shop at a startup that uses Go. From I recall his main reason for choosing it was to hire cheaper less experienced developers. I remember talking to him about Go and he remarked something like: If you want to clean modular code don’t use Go.

Not to disparage less experienced developers but I think teams of developers of any experience level need to have code governance and oversight regardless of the technologies and that a good team with good practices can create good code bases even with more complex and expressive languages. I know another colleague who did this with Scala and was able to properly mentor more junior developers by leading by example. I have not used Go. I have done and lot of Java and a bit of Scala and have many times leveraged generics to create a very high degree of reuse. Without them clearly you get a lot of boilerplate code which makes a codebase larger which leads to another type of complexity in my opinion. So the question is which scenario increases your codebase complexity and that probably boils down to what domain you are developing in. I explore some ideas relating to that tradeoff here [0]. Go has a specific use case that it targets which I believe is services and certain aspects of concurrency.

Clearly the Go language and environment have value in the industry, however, as a language it offers little for people who want to have an opportunity grow and learn about more advanced concepts wrt to PLT and CS in general. I have a friend who is a Go fanatic and I try to encourage her to push her limits, but she feels and she can bang out service level code very quickly and she can as she is quite talented. Of course you can do that with Spring Boot as well. Regardless of your language you should always be trying to grow as a developer otherwise you risk becoming obsolete.

To put it bluntly and I may get downvoted for this I feel Go is the “Rise of the Expert Beginner Language”. [1]

[0] http://www.elegantcoding.com/2012/02/software-reuse-complexi...

[1] https://www.daedtech.com/how-developers-stop-learning-rise-o...

Re: Why Go is my favorite programming language

#113

Earlier quoted context omitted.

Ultimately, programmers fall in a bell curve. Most languages which benefit extensively from that research target people on the right of that bell curve. Go, with its lack of complicated mechanics targets the middle of the bell curve. I don't have the luxury of working exclusively with people on the far right of the bell curve, so I'll end up picking Go with its simplicity for most projects. I can be assured that almo…

> Go, with its lack of complicated mechanics targets the middle of the bell curve. No, it targets the less experienced - interns, as the language creators said.

I don't think Go targets the less experienced. Could you provide a resource, where the language creators have stated that Go targets interns?

Go is a safe programming language, but it is not simple. Go has very rigid rules.

I don't see any difference in complexity between programming in C and programming in Golang. Programming in Golang may even be harder than C.

If you format your code wrong, Golang screams at you.

If you import a package and never use it, Golang screams at you.

If you redefine a defined variable, Golang screams at you.

If you don't use a variable you defined, Golang screams at you.

C is much more forgiving :).

Golang makes dynamic memory management safe, but in nowhere easy. You still use the good old void* via an empty interface. For an intern, garbage collection doesn't matter, an intern is intelligent enough not to leak so much memory so that it will get noticed :).

I sometimes think Golang resembles the early versions of Java. Creating a safer C-like language, with great ideals. With Java the complexity kicked in after a while. Golang still resists the urge to please everyone.

Re: Why Go is my favorite programming language

#114
post #79
post #2

I think regardless of how each one of us sees Go, its adoption among DevOps (Docker, K8s), Apple and Microsoft means that just like with C and JavaScript it will become unavoidable to use it for certain tasks.

Adoption from Apple? If you mean on their internal services, then that's irrelevant as to the rest of us "having to use it".

They have quite a few open positions asking for Go knowledge.

No idea how they are using it.

Re: Why Go is my favorite programming language

#115
post #91
post #2

I think regardless of how each one of us sees Go, its adoption among DevOps (Docker, K8s), Apple and Microsoft means that just like with C and JavaScript it will become unavoidable to use it for certain tasks.

I'm not sure that I follow. To me, it sounds like someone saying we need to program in C because we use git whereas we actually interact with git through the interface they've given us, not through its source code. Even if Docker and K8s become ubiquitous, I see no reason programmers taking advantage of these to also program in Go.

It means that anyone that is working on DevOps, while having Docker/K8s on their employer infrastructure, might eventually be asked to write Go for whatever reason.

Given that they are written in Go, and as far as I understand it, the way to customize them also requires using Go.

Re: Why Go is my favorite programming language

#116

Earlier quoted context omitted.

No, it's not safe. It's basically a way to disable compiler checks, so it is by definition, not safe.

It is way safer than void * : A void * can be cast to (and then used as) any arbitrary type, leading to all sorts of undefined behavior. On the other hand, the following code will just panic() (i.e. exit cleanly without corrupting memory). var x int = 5 var i interface{} = &x *(i.(*string)) = "boom"

> It is way safer than void *

I said "it's unsafe", not "it's not safer than void*".

> (i.e. exit cleanly without corrupting memory).

This makes no sense. If it exits, who cares if the memory of the process is corrupted?

Also, this is the point: it exits instead of the compiler telling you this code will crash before you ship it.

That's the point of static type safety (which Go doesn't provide in this case): it lets you ship code that is provably incorrect and that will not work once deployed (it will exit, like you say).

This is why I said "it's unsafe".

Re: Why Go is my favorite programming language

#117

I really dislike Go as a language, it has very few means of abstraction and it feels depressing that people think you have to throw out decades of PLT research to achieve perceived clarity like this. That said, these reasons are almost all linked to tooling, which is something that I have to admit Go gets right, but they're not intrinsically linked to the language itself and its feature minimalism. I wish there were…

Ultimately, programmers fall in a bell curve. Most languages which benefit extensively from that research target people on the right of that bell curve. Go, with its lack of complicated mechanics targets the middle of the bell curve. I don't have the luxury of working exclusively with people on the far right of the bell curve, so I'll end up picking Go with its simplicity for most projects. I can be assured that almo…

Can testify that other people do limit the tools you can use. I was on a project that I couldn't use even use interfaces, streams, classes, or generics because the other programmer was incapable of understanding how they worked. I eventually just switched to a tool that did the work we were working on to solve the problem without programming because that guy despite having a masters degree in CS and ton of certifications was incapable of understanding anything remotely outside of procedural programming.

Re: Why Go is my favorite programming language

#118
post #114
post #79

Earlier quoted context omitted.

Adoption from Apple? If you mean on their internal services, then that's irrelevant as to the rest of us "having to use it".

They have quite a few open positions asking for Go knowledge. No idea how they are using it.

Yes, I meant it's not like Apple is forcing it on external developers though, like e.g. they "force" Swift.

Google could do that (if they adopted Go on Android), but I think they went with Dart instead IIRC.

Re: Why Go is my favorite programming language

#119

Earlier quoted context omitted.

After having coded tens of thousands of lines in Golang for 4 years, there are a list of probably hundreds of grievances I have about the language itself. The problem is that they're generally outweighed by the simplicity, consistency, and clarity of the language. Is the error system terrible? Obviously. Lack of abstract data types? Awful. Is Rust one thousand fold safer and more syntactically powerful by comparison?…

Why learn a new language just to learn a new language for production stuff? I looked at at switching to Go from Java for my flagship product. I couldn't find enough compelling reasons to switch. It didn't offer enough benefits to outweigh the benefits of Java + Spring Boot. As a result, Java it is. Now for a new product that I might sell as traditional installed software, Go makes some sense here since it simplifies…

My team just chose golang instead of java or dotnet core for a new crud app. I'm not especially fond of go, but mean length of feedback loops are worth it (so far). We have a bunch of tests, and they all run in a few hundredths of a second. Same coverage in java is usually several seconds at least. Often up to 30s if running tests with maven.

Standing up the app is also instantaneous. Spring boot apps with hibernate often take at least ten seconds. In prod this doesn't matter. But a cheap app start means integration tests are cheap. An fs hook runs both unit and integration tests every time the code changes.

ps. all the things people hate about go are true

Re: Why Go is my favorite programming language

#120
> There is a cost to introducing an abstraction layer. Go code is usually rather clear, at the cost of being a bit repetitive at times.

Go programmers say this a lot and every time I see it I wince. We've had all sorts of flights of fashion and fancy in the programming world, but one observation has emerged that seems closer to fact every time we test it: more code is more bugs. The more code you write, the more chance there is for bugs.

And so it's so confusing to me why Go programmers simply discard this information, universally accepted as it has come to be. "The repetition is simple," they reply, "and of course abstractions have cost."

So what is the cost? Because I can tell you the state of affairs right now. I find Go code exhausting to debug, because there is effectively no universal way to handle errors other than to copy-paste if-nil statements. Occasionally, slightly different error handling logic creeps in and it's so tempting to start pattern matching the whole block of code and miss these subtleties.

This list's discussion here... Well sometimes I get the impression that Go programmers are more interested in never having the opportunity to make a conscious mistake, in exchange for making lots of unconscious mistakes.

Go has popularized a mode of writing code where not only are abstractions unwelcome, but they're nearly impossible. As such, it is quick to learn the syntax. It's not really any quicker to learn how to write good robust multi-threaded code though. I still think the Java standard library consistently delivers a better result for equivalent work, at the cost of learning and extra (standard) library.

I just don't understand why anyone appreciated go's design space outside of engineers-turned-architects trying to staff a massive tech org with engineers they don't think very much of and have no desire to train.

Post reply on HN