←back to thread

Go subtleties

(harrisoncramer.me)
234 points darccio | 3 comments | | HN request time: 0s | source
Show context
DarkNova6 ◴[] No.45667140[source]
As somebody who only views Go from a distance, I see this list as a combination of „what‘s the big deal?“ and „please don‘t“.
replies(2): >>45667192 #>>45672374 #
OvervCW ◴[] No.45667192[source]
I'm amused by posts like this because it shows that Go is finally slowly moving away from being an unergonomically simplistic language (its original USP?) to adopt features a modern language should have had all along.

My experience developing in it always gave me the impression that the designers of the language looked at C and thought "all this is missing is garbage collection and then we'll have the perfect language".

I feel like a large amount of the feeling of productivity developers get from writing Go code originates from their sheer LOC output due to having to reproduce what other languages can do in just a few lines thanks to proper language & standard library features.

replies(8): >>45667300 #>>45667358 #>>45667372 #>>45667409 #>>45667468 #>>45667838 #>>45668913 #>>45675568 #
liampulles ◴[] No.45668913[source]
As a Go developer, I do think that I end up writing more code initially, not just because of the lack of syntactic sugar and "language magic", but because the community philosophy is to prefer a little bit of copying over premature abstraction.

I think the end result is code which is quite easy to understand and maintain, because it is quite plain stuff with a clear control flow at the end of the day. Go code is the most pleasant code to debug of all the languages I've worked with, and there is not a close second.

Given that I spend much more time in the maintenance phase, it's a trade-off I'm quite happy to make.

(This is of course all my experience; very IMO)

replies(1): >>45669075 #
miohtama ◴[] No.45669075{3}[source]
How much is premature in time? 10 years? 20, 30 years?
replies(1): >>45669274 #
1. liampulles ◴[] No.45669274{4}[source]
So for me, the question is: are these two things intrinsically the same or coincidentally the same? If it is intrinsically the same, then an abstraction/centralization of logic is correct. If they are coincidentally the same, then its better to keep them separate.

Its premature if I don't know the answer to that question with my current information, which is a common scenario for me when I'm initially writing a new set of usecases.

If I get a 3rd copy of a thing, then its likely going to become an abstraction (and I'll probably have better understanding of the thing at the time to do that abstraction). If I don't get a 3rd copy of that thing, then its probably fine for the thing to be copied in 2 places, regardless of what the answer to my question is.

replies(1): >>45675466 #
2. ted_dunning ◴[] No.45675466[source]
On the other hand, when your abstraction has more configuration options than methods, it is a sign that (years ago) it really wasn't an abstract at all.
replies(1): >>45678868 #
3. liampulles ◴[] No.45678868[source]
Totally agree.