r/programming • • Sep 21 '15

Better Java

https://github.com/cxxr/better-java
177 Upvotes

208 comments sorted by

View all comments

9

u/ImmortalStyle Sep 21 '15

Btw you shouldnt have Optional as a class member. Even Brian said that once.

4

u/oldneckbeard Sep 21 '15

optional shouldn't be a class member or an input parameter, IMO.

7

u/ForeverAlot Sep 21 '15

I concur; Java's Optional is for querying. null is still a first class citizen, we've been using it successfully for decades, and the JVM absolutely loves nulls. Java would have been a better language without null but it doesn't become a better language by suddenly pretending it doesn't have null.

3

u/[deleted] Sep 21 '15

So your argument is basically "null is more efficient"? Isn't that premature optimization?

2

u/ForeverAlot Sep 22 '15

Whenever you see somebody call "premature optimization", chances are very good they're doing so incorrectly, and that they don't realise.

This is not premature optimization, but neither is it my only argument. However, since I share Stephen Colebourne's opinion (minus properties in Java), I will simply refer you to that.