Live data from Hacker News

Why I’m Frustrated with Go

dev.to

161–170 of 233 posts

Re: Why I’m Frustrated with Go

#161
post #48

Earlier quoted context omitted.

And java doesn't have them either. You need to use an external library, likely the google containers library.

Java does have unmodifiable wrappers but they implement the same basic mutable Map/List/etc. interfaces, just throwing at runtime if mutating methods are called. Not exactly optimal but better than nothing.

Better than nothing but worse than the C++ solution of returning a const reference which can be checked at compile time.

Both are just immutable views on top of mutable containers. But in both C++ and Java it is trivial to create a truly immutable container of T. Not so in Go.

Re: Why I’m Frustrated with Go

#163
post #153

Go's been great for creating a web scraper. But it's been an unmitigated disaster for being able to write the data to a database due to the immaturity of ORMs. Might as well not pretend something is an ORM if it can't do the fundamentals (like upserts), fully hydrating structs, etc.

Similar to doublerebel/publictransport, I ran into some issues hydrating structs the way I expected from other languages.

So I wrote bellows [0], a helper to flatten and expand nested maps and structs. Not quite the same but might help someone.

[0]: https://github.com/doublerebel/bellows/blob/master/README.md

Re: Why I’m Frustrated with Go

#164

I keep getting drawn back to Go. I left it a while back, with a lot of the same frustrations. But then I tried a bunch of other things, and nothing seemed to work better. There seem to always be some frustrations with whatever language. And I found myself craving that simplicity again. I might get annoyed with it again, and try some other stuff. And that might stick. But I suspect Go is the worst language except for…

I did the back-and-forth for several years with Go. What drew me in was promises and wishes, what made me leave every time was realizing I had fallen for the same stupid trick again. It only looks simple because of the features they skipped and the arbitrary limitations they decided on. Once a codebase reaches a certain level of complexity and the need for more powerful abstractions arises, the perceived simplicity is no more.

Re: Why I’m Frustrated with Go

#165
After a year of programming with Go I have noticed that I, an old C++ programmer, have the reflex to decompose a program in terms of interacting data structures (objects) which encapsulate their behavior. I programmed like that in Go in the beginning. But when I looked at other Go code and especially the std lib code which is easily accessible, I was always amazed at the simplicity of the code. Now I try to write simple programs and this is hard after years of C++ programming.

I don't know if there is a term for Go like programming. I'm tempted to call it minimalism. It may be uncomfortable for people coming from classical programming, but the simplicity of the language and the code is a clear win in the long run.

Re: Why I’m Frustrated with Go

#166
post #20
post #16

The link to the immutable, ordered map that "Java provides" seems to be a link to a third-party library created by Google. If that's enough for you to consider that a language provides a feature, just wrap the immutable ordered map implementation in your blog post in a library, publish it, and now Go provides that functionality too.

Is it possible to write a reusable version of something like this in Go without using interface{}?

It is, of course, possible to write reusable containers without interface{}[1], but it is not exactly a replacement for proper generics.

[1] https://play.golang.org/p/2GZRkMJ_Mf

Re: Why I’m Frustrated with Go

#168
post #136
post #11

I did Go for years, but stopped doing any serious work in it about a year ago. In general, I found it a chore to maintain Go-based systems. There's a lot to like about Go. But it doesn't seem pragmatic for the types of applications I see people using it for. For example, the entire error thing is absurd. Anders Hejlsberg got this right many years ago: 9 out of 10 errors are "handled" by a central error handler (log +…

Wat. OpenResty as an alternative to go? Wat? Please, nobody write full fledged WebApps or all of your middleware in lua. Trust me that's a horrible idea. I have seen about everything you can do in lua/nginx and it does not turn out pretty.

I honestly thought the OP's post was a troll. Lua is for masochists.

Re: Why I’m Frustrated with Go

#169

Earlier quoted context omitted.

Spot on. As a card-carrying dinosaur I've found myself from time to time needing to read up on some "new" (usually turns out to have been invented in the 60's) coding thing. Once I figure out what it is, I ask myself what problem it solves (the literature typically doesn't say). The answer tends to be one of: 1. Saves some typing. 2. Saves some work when refactoring. 3. Avoids some class of bug. 4. Highly useful in a…

Absolutely. With respect to this article and immutability, the strongest arguments I've seen for it are for concurrent programming, like the very successful Erlang solutions used at Ericsson, which I generally don't have an interest in. So, it is reason #4 on your list. For the types of program and the types of problem I need to solve, it's a moot point - people have been getting along just fine without immutable sta…

Limiting mutability is not new and it's not a fad. It is at the very core of every single principle of modularity and dependency management ever invented by mankind, even beyond programming.

Almost 30 years ago when I first learned C one of the first design principles I was taught was to avoid mutable global variables. And ever since that time I haven't found anything as key to avoiding bugs as knowing and controlling exactly what code can change what data.

I find it totally baffling that a practicing programmer could possibly think of mutability as a purely theoretical concern.

Post reply on HN