Live data from Hacker News

Why Go is my favorite programming language

michael.stapelberg.de

141–150 of 256 posts

Re: Why Go is my favorite programming language

#141

> 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 chan…

As Sandy Metz once said, "A little duplication is far better than the wrong abstraction." After a decade of OOP indoctrination and misuse, we see the results of this. > Go has popularized a mode of writing code where not only are abstractions unwelcome, but they're nearly impossible This lends me to believe you actually haven't written any go code for yourself. This is the same thing every OOP-indoctrinated developer…

> As Sandy Metz once said, "A little duplication is far better than the wrong abstraction."

like writing 500 * if err != nil { return err } is an average Go app? A little yes, but this isn't a little.

Re: Why Go is my favorite programming language

#142

> 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 chan…

>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.

A certain demographic can't stop waxing erotic about "being in the flow" and so love nothing more than churning out 1000 lines of mindless boilerplate, for this chunk endless if-nil checks are a feature not a bug because it's rote and adds to the line count.

Re: Why Go is my favorite programming language

#143
post #70

Earlier quoted context omitted.

Sadly, it ends up far more verbose than Java when you have (as I did after trying to port a project from java to go) over 200 copies of the same observable, sorted, copy-on-write set implementation, because Go doesn’t have generics. And then you change one thing in one place, and gotta change it everywhere again. No thanks.

Surely you could have used interfaces for this case, no?

A couple reasons that wouldn't work well (there may be more, I haven't thought about this much):

1. Using an interface would nuke your performance. Data structures where every data structure operation requires one or more vtable lookups on items in the structure can really hurt your time and space performance. To get good performance, you need true type-level generics so the compiler can specialize at compile time.

2. Anyone could put anything that followed the interface in the data structure, even if it was of the wrong type. To get any form of static type safety, you'd still have to define a wrapper type and a bunch of functions for every type you'd want to put in the data structure. You could save a bit of work by re-using your (slow) code you wrote generically using interfaces.

Re: Why Go is my favorite programming language

#144
post #135

Earlier quoted context omitted.

I love the error handling in Go. Every other language I've used led to the inevitable and useless "An error was encountered" message. Go is the first language where I can actually access the original socket permission error because it was actually passed up.

> Every other language I've used led to the inevitable and useless "An error was encountered" message. I can't think of a single language except C where this has been a problem for me. What are you referring to?

What's weird is that what they're describing is actually really tricky to do reliably in Go unless you totally understand every library beneath you.

Much bad can be said about checked exceptions, but they certainly helped with that problem...

Re: Why Go is my favorite programming language

#146
post #140

Earlier quoted context omitted.

Regarding your last paragraph, it's a reflection of the state of the industry. The vast majority of "software engineers"/"full stack developers" can't be bothered to learn new skills or improve their existing ones, so any popular programming tool is stuck catering to the least common denominator. Do you carefully review your own code? Do you voluntarily learn any new skill beyond "blog post intro tutorial" level? Do…

> Do you carefully review your own code? Do you have any resources for getting better at this? I don't get a lot of chances for other people to review what I write (yeah believe me I know..) and am looking into better ways to make sure I don't release shit. I have a decent amount of testing automated for a majority of my projects but that's turning into an extra job on-top of my already demanding job.

It sounds like you're already doing a good job of trying to not ship garbage.

Re: Why Go is my favorite programming language

#147

Earlier quoted context omitted.

> 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.…

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

"They’re typically, fairly young, fresh out of school, probably learned Java, maybe learned C or C++, probably learned Python. They’re not capable of understanding a brilliant language but we want to use them to build good software. So, the language that we give them has to be easy for them to understand and easy to adopt." - Rob Pike

Re: Why Go is my favorite programming language

#148
post #47

Earlier quoted context omitted.

> go has a short list of reserved words I use go a lot now. However, I must admit I find the use of interface{} "aka empty interface, aka void*" a weird one. It's technically correct, but it's an odd semantic.

interface{} carries runtime type information in its internal double-word (type + pointer) structure, unlike void*.

[deleted]

Re: Why Go is my favorite programming language

#149

Earlier quoted context omitted.

Sadly our entire industry is based around being short sighted. Quick to learn is only important if you have the lack of patience to spend the time to learn something you'll be using for years.

Our industry is hugely based on illusions and misconceptions. There are only few places on earth where people regularly rebuild the skyscrapers to build taller ones. The IT industry simply forces you to re-learn the same old paradigms in a new package just to gain 0.1% of something we cannot even define as an improvement.

Architecture is thousands of years old. Programming as we know it is maybe 60.

We're still figuring out how to do things correctly. Maybe we just figured out how to build a log cabin, but now some people are going back to mud huts because they're simpler.

Re: Why Go is my favorite programming language

#150

> 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 chan…

I love the error handling in Go. Every other language I've used led to the inevitable and useless "An error was encountered" message. Go is the first language where I can actually access the original socket permission error because it was actually passed up.

> Go is the first language where I can actually access the original socket permission error because it was actually passed up.

Now try to trace them as easily as exceptions. Oh wait, you can't unless you wrap Go errors into some struct from a library that isn't in the std lib therefore everybody has different systems to trace errors /s

i'll take exceptions over this (which go has, panic/defer). error is just a convention, it's not an error system.

Post reply on HN