4 ms·
> Go has achieved a lot of success without them This is a dangerous and slippery slope to engage on. Java was also extremely successful in 2004, before it su
by hota_mazi 10y ago
> Go has achieved a lot of success without them
This is a dangerous and slippery slope to engage on.
Java was also extremely successful in 2004, before it supported generics. Yet you'd be hard pressed to find a Java developer who thinks that generics were not overwhelmingly beneficial to the language, and probably one of the main reasons why Java is even more dominant and powerful today than it was pre-generics.
- geodel 10y agoFor my purpose generics in Java are not overwhelmingly useful. I work on a quite big and successful, Java application inside our company. And it was written mostly after Java 1.5 but hardly use much of generics. It may have many issues but none related to generic. I am not saying generic are not useful. But I have not found enormous use of Generics in typical Java business application. The most common generic data structure I have used in Java are Maps and lists which are already generic in Go.
- hota_mazi 10y agoI think you are underestimating the indirect effect that generics have had on your code, even if you don't use them directly yourself. Thanks to generics, millions of lines of code in libraries that you are using became safer and faster, and you are benefiting from this, even if it's not apparent to you. Basically, generics made Java a better and safer language. Both theoretically and practically.
- hodgesrm 10y agoI have been a Java developer since the JDK alpha in 1995. It was apparent then that Java was going to be pretty big due to the fact it was VM-based, addressed a lot of pain points like platform independence/concurrency/interfaces/etc., and was similar enough to C/C++ that people would adapt to it quickly. The language experienced an enormous network effect due to the tooling and support libraries that allowed Java to become dominant in enterprise development. It's hard to argue that a feature that appeared a decade later changed the equation all that much. I like generics but would still use Java even if they did not exist. In my work the concurrency features are far more important.
- jksmith 10y agoBuyin and successful are not necessarily the same thing. Designers of Go have been disciplined enough to keep things simple - let's you keep more of the problem domain you're trying to solve, along with the code to solve it, in your head. Try that with a big project using another toolchain - lots of frameworks, lots of places to plug your code, with less coherency (in my experience) across the various experience levels of your team. And I'm talking about big teams here, not 10 devs. Subjective Success metric with comparable teams: Go vs <x with generics>. If Go team gets solution done faster, correct, within budget compared to other team, your stakeholders will not give a crap about what devs think about generics. There's a good chance that would happen, based on my experience.
- yarrel 10y agoGenerics for a language with a common base class object are a category error. Java's current popularity is due to Android, not the bloated corpse of enterprise Java.
- hota_mazi 10y agoJava has been in the top three most popular languages since the early 2000s. Android certainly made it more popular than it already was, but Java was extremely popular way before Android appeared.
- prodigal_erik 10y agoTypes like Object and Comparable<T> allow heterogeneous collections and algorithms, which are occasionally useful even in an otherwise statically-typed language. Think of it as a set of types where otherwise you would have required boxing everything within a single type and eventually reimplementing the type system. If Java had generics from day one, they could have put methods like equals and hashCode in interfaces that some classes don't implement, instead of passing static type checks and then blowing up at runtime because you did something that never made sense.
- skybrian 10y agoWell, except that some of us do remember Java 4 fondly. It was a much simpler language and that was quite a good thing. I'd say "overwhelmingly beneficial" is an exaggeration.