Live data from Hacker News

Three Months of Go from a Haskeller’s perspective (2016)

memo.barrucadu.co.uk

71–80 of 162 posts

Re: Three Months of Go from a Haskeller’s perspective (2016)

#71
post #18

Go is a programming language for teams, not primarily designed to impress individual programmers... I agree with all points with the author. But working in teams, or even mutiple teams on the same software, then go solves a lot of problems for you.. Yeah its a dumb language, missing a lot of features. But there is only 1 way to program, dependency management is sane (no circular dependencies), and the language is bui…

The argument for Go being a simple language that naturally produces code everyone can easily grok comes up time and time again.

I have never gotten it. I find Go code somewhat easy to write, just just give up on trying to be concise or elegant, but not at all easy to read. The excessive boilerplate just makes me feel like my brain does not have the working memory to piece it all together.

The constructs are simple, true, but if you are trying to write anything non-trivial, then simple syntax will not make your problem simpler. It is just expressed in tens of times more lines than in Elixir, Haskell or even PHP. This takes a toll on the reader.

As an example - you can accomplish interesting projects with Lego. And it is easy to get going for sure. But at some point, when you are trying to do something non-trivial, it becomes a hindrance, despite it's simplicity. Hence "I built a life-size XYZ in Lego" becomes impressive in it's own right.

Oh, and Go modules is a story of a train wreck.

Re: Three Months of Go from a Haskeller’s perspective (2016)

#72
>The way in Go to handle possibly-failing functions is to have multiple return values: an actual result, and an error. If the error is nil, then the actual result is sensible; otherwise the actual result is meaningless. This means you can forget to check the error and use a bogus result and, because there are no compiler warnings (another wtf), you will know nothing of this until things fail at runtime.

? You can't forget to check the error because not checking err is a compiler error unless you forcibly mute it by using _

Re: Three Months of Go from a Haskeller’s perspective (2016)

#73
While the author has a very Haskell-centric view and his comparison is a bit biased, I completely relate with some of his points.

"Use it more" is not an answer. If you have found a good way to produce software and it has served you well -- even better if you had other ways in the past and your latest one is objectively better! -- then you are not under any obligation to "give it a chance".

Many people longed for certain ways of doing things and one day they found the tools that enable them. That's quite fine. No need to insert platitudes in there which can't ever be satisfied (like "use it more", especially if you are not inclined to).

Re: Three Months of Go from a Haskeller’s perspective (2016)

#74

Go is like SQL, where it's pragmatic for TEAM work, where your teammate has little background on programming, because Go code is easy to follow, extend (copy and paste and modify). In my case, my team is composed of most of DBA experts, they have no problem following Golang code. So your programming languages of choice should base on your team.

> So your programming languages of choice should base on your team.

While that is a good thing to keep in mind when making tech decisions, make sure not tunnel vision only on it.

More about that here https://news.ycombinator.com/item?id=24880273

Re: Three Months of Go from a Haskeller’s perspective (2016)

#75
post #39

Earlier quoted context omitted.

Dialyzer is fully integrated into Elixir, yes. But again, it’s optional typing.

I know how to use Dialyzer and am quite proficient with it. I cannot say, however, that it helps me in any way. I think strong typing is a crutch for bad programmers and I've yet to encounter anything in my 30+ years of programming to change my mind.

Strong typing can be a crutch for bad programmers in the same way that a prosthetic leg can be a crutch for an amputee.

The world record 100m men's sprint for double-leg-below-the-knee amputees is now frozen at 10.57s (record set in 2013); omitting Usain Bolt who is clearly freakishly good even among world-class sprinters, the 100m world record is 9.74s.

I am very happy to use strong static type systems.

Re: Three Months of Go from a Haskeller’s perspective (2016)

#76
post #30

> In Go, you import packages by URL. If the URL points to, say, GitHub, then go get downloads HEAD of master and uses that. There is no way to specify a version, unless you have separate URLs for each version of your library. Go modules has solved this problem. I find that in practice Go modules work very well. Certainly better than the alternatives and I've been through most of them. Incrementing the major version o…

The OP is from 2016

@dang, can you fix the title?

Re: Three Months of Go from a Haskeller’s perspective (2016)

#77
post #43

Earlier quoted context omitted.

Yeah it's hard to write weirdly complicated code in Go. Stick Java or C# in the hands of a team and before you know it you've got typed factory service factories and every abstraction known to man.

What higerorderma said above applies to this ^ comment as well. It is another of those nonsensical things that keeps getting repeated all the time by some Go programmers. That line of thinking promotes workarounds over long-term solutions. If your team has people who are abusing tools (like types, abstractions etc), the solution is to teach them how to not do that. The solution is NOT to remove the tool itself! That…

Why do you think it gets repeated by Go developers?

I was a C# developer writing all these abstractions like every other C# developer does. It's idiomatic C#. OOP exists, you're encouraged to use it to abstract and decouple code.

Even if you try and strip all that away, you'll never escape it because every library you depend on is written this way. For example, try understanding https://github.com/protobuf-net/protobuf-net like I once did. The cognitive load is huge.

This is C#, this is what having a huge toolset results in.

A simple language with simple code isn't a shortcoming. It's an advantage. Overly complex code is a shortcoming.

I liked writing heavily abstracted code in C#, that's what I used to do every day. But I never liked reading other people's code because without the intimate knowledge of the code it is a huge mental load. Onboarding new developers into a code base they are unfamiliar with is also very time consuming.

In Go I realised that the only abstraction you need is an interface. There's no "abstraction first" mentality like there is in C#. You can define interfaces at any point in time, whereas in C# you must define an interface first, and if you don't then you end up going the OOP route with more abstraction.

And because of this small toolset, reading other people's code is easy. It all looks the same.

Re: Three Months of Go from a Haskeller’s perspective (2016)

#78
post #39

Earlier quoted context omitted.

Dialyzer is fully integrated into Elixir, yes. But again, it’s optional typing.

I know how to use Dialyzer and am quite proficient with it. I cannot say, however, that it helps me in any way. I think strong typing is a crutch for bad programmers and I've yet to encounter anything in my 30+ years of programming to change my mind.

There are type systems out there that allow you to model more than "is a string, is a float, is an int".

There are CVEs for use-after-free bugs in Firefox, IE, the Linux kernel and more. Rust's type system helps prevent those. There are CVEs for double-free bugs in OpenSSH, OpenSSL, and Kerberos. Again, Rust's type system helps prevent those. There are CVEs for null dereferencing in the Linux kernel, CUPS, and OpenSSL. Many languages have type systems that help preventing those.

There's many more classes of bugs that can be prevented by judicious use of robust type systems. Dismissing strong, static typing as "a crutch for bad programmers" is just plain wrong.

All of this, of course, assumes the only use for static types is preventing issues. Algebraic data types actually allow you to write simpler, more concise code in languages that support them. Typeclasses make for a whole model of polymorphism that's just incredibly painful to implement in languages that don't support them.

Re: Three Months of Go from a Haskeller’s perspective (2016)

#79
post #74

Go is like SQL, where it's pragmatic for TEAM work, where your teammate has little background on programming, because Go code is easy to follow, extend (copy and paste and modify). In my case, my team is composed of most of DBA experts, they have no problem following Golang code. So your programming languages of choice should base on your team.

> So your programming languages of choice should base on your team. While that is a good thing to keep in mind when making tech decisions, make sure not tunnel vision only on it. More about that here https://news.ycombinator.com/item?id=24880273

Yeah, especially when there are not only preferences in between but also other strong reasons to help the team to decide to pick one or another language for the job(s).

I would like to use Go, Haskell, Rust or whatever that I like (or my team as well) but this is just one piece of the whole cake IMO.

Re: Three Months of Go from a Haskeller’s perspective (2016)

#80
post #31

Earlier quoted context omitted.

> other than that it is a very tedious language And that, is precisely why it is a good language for teams.

Yeah it's hard to write weirdly complicated code in Go. Stick Java or C# in the hands of a team and before you know it you've got typed factory service factories and every abstraction known to man.

> Yeah it's hard to write weirdly complicated code in Go

Just because Go lacks many forms of abstraction, doesn't mean complex code will not be created with it. Quite the opposite. It's lack of expressiveness will encourage "frameworks", elaborate encodings, code generation and various productivity aids. Look at what the lack of generics has done to the Kubernetes code base:

"The core team replaced a compile-time language feature that was missing (Generics) with their home-built runtime system"

https://medium.com/@arschles/go-experience-report-generics-i...

Post reply on HN