4 ms·
Same here... Except that I've been doing that since years and years and years. Way before "functional Java" came out. I learned about basically every single "
by martinced 14y ago
Same here... Except that I've been doing that since years and years and years. Way before "functional Java" came out. I learned about basically every single "trick" TFA describes (and more) on Usenet, in comp.lang.java.programmer, back in the days.
The "abstract" keyword is forbidden (I know a lot of OO "experts" that are going to explain how bad this is). No public constructor (they do break encapsulation and hence it's a gigantic no-no). Every single class is final.
Liberal use, everywhere, of multiple (interface) inheritance.
@NotNull everywhere. Really. I hardly know what a NullPointerException is since 5 years or so.
The final keyword is used nearly everywhere.
Most classes do throw a Runtime exception if you try to call hashcode() or equals() on an object (because in anything but the simplest case, where there's only one level of inheritance, the hashcode() and equals() contract cannot be guaranteed -- This fact was explained in "Effective Java" by Joshua Bloch back in the days and is not open to discussion).
Basically I'm doing "OO over immutable objects" and it's much easier to reason about the state while programming this way.
The most laughable thing of them all is that years and years ago when you'd talk about that on comp.lang.java.programmer people like Jon Skeet (you know, the StackOverflow user with the biggest reputation of all StackOverflow) would call you crazy and explain why the "common" way was the one true way. These were the kind of people explaining how James Gosling was a god for not adding enums to Java and why Java applets were the best thing since sliced bread.
One IBM JVM engineer would regularly hand Jon Skeet's arse to him by the way.
And now... Oh the irony, Jon Skeet on StackOverflow is basically rewriting exactly what these precursors where telling on c.l.j.p. years and years ago.
So, slowly, people are starting to accept that it may not have been that great an idea to allow the addition of mutable, extendable objects in a hashmap.
Thankfully things are changing for the best, at last... : )
If you think it's hard to not be a roman in Java Rome today, you have zero idea what it was like to not be a roman in Java Rome during the Usenet days.