Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

No, it's relative. For the top 5% - 10% of developers, generics are a useful tool for doing their job efficiently. For the bottom 50% of developers, generics are complex and confusing, and only provides more footguns.


For 0.5%-1% C++ is a powerful tool which allows to quickly (thanks to rich abstractions) to write high-performance code.

For merge mortals it is a tool hard not to misuse full of hidden traps and debugging of code written even by the very best developers (surprise - it has bugs too) is a challenge.

Go just did a step towards C++, even if a tiny one.


Not everyone is entitled to be a sushi master.


And the top 1% of developers know that you are most productive when you stick to the simplest primitives ;)

I jest, but I also don't. All the best developers I know strongly prefer footgun-free libraries and primitives. The advantage is that you don't _need_ to spend brain cycles checking and double checking that it was written correctly, and when you want to make changes you don't need unwind an elaborate abstraction to stretch it further.

In martial arts (I'm a second degree black belt), the third move you learn is the round house kick (turned leg kick - the first two moves are the punch and the straight leg kick). At the olympic level, 70% of all points are scored using a roundhouse kick.

The other funny thing about the roundhouse kick is how much you can learn from watching someone do a single one. You can tell the difference between someone with 2 years of experience and 3 years of experience, and you can _also_ tell the difference between someone with 15 years of experience and 20 years of experience.

The point of this story being that masters are masters not because they can do elaborate techniques, but because their command over the simplest techniques is superlative.

I've found in life that this applies to pretty much everything. Martial arts, programming, painting, cooking, and effectively any task that definitively has some people who are better than others.


Generics use the type system to make the compiler check the code for you. It makes the code easier to understand, more correct, and concise if you use them as they were intended. It avoids tedious and error prone duplication of logic. Create ONE efficient debugged implementation and reuse it as much as possible. The crappy workarounds for generics introduce their own complications and issues.

But I know what you mean. I've worked on Scala code for years and seen less mature developers over-engineer things and get way too clever with the type system. Scala is a really practical and powerful industrial language that requires some maturity to use the abstractions sparingly. It's only good for the top 5% of developers.

However, Go doesn't have such a powerful type system. It looks like the Go designers implemented relatively simple generics. You have to draw the line somewhere. If simple Go generics are too confusing and complicated then that developer should probably find another job, as generics are a basic concept in programming. The Go designers are pragmatic people, and they've decided that relatively simple generics will make things easier in mainstream commercial codebases.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: