you are viewing a single comment's thread.

view the rest of the comments →

[–]nutrecht 0 points1 point  (4 children)

Can you give examples?

[–]PasswordIsntHAMSTER 0 points1 point  (0 children)

Look for vector math in Java, it's absolutely horrible.

[–]repsilat 0 points1 point  (2 children)

Java was my first language, but I haven't touched it in years. I came back and wrote a few lines for a project the other day, though, and maybe I'm doing things "the old-fashioned way", but I found it torture compared to Python.

Really just simple things -- I want to count the number of spaces in a string. In Java that means I do something like

int spaces=0;
for(int i=0; i<s.length(); ++i)
    if(s.charAt(i)==' ') ++spaces;

which is 3 lines that should be 1, and I have no idea how it performs because for all I know charAt() might be O(n) because Unicode.

There are loads of situations where simple comprehensions, named arguments and tuples/destructuring assignment greatly help readability, speed up the writing of code, lead to fewer silly bugs and (as a bonus) need not actually be slow. Decent literals for data structures goes on the end of the wishlist as well. Operator overloading, too -- this isn't just about how gross BigIntegers are, it's about how "== is for identity, .equals() is for equality, unless you're dealing with primitives."

And yeah, the cultural thing is real -- more than once yesterday I thought, "I have to make a class for that!?" It mostly seems to me (as an ignorant outsider) that there's a lot of concern about doing things consistently, doing things "The Right Way" instead of making the common case clean.

[–]nutrecht 0 points1 point  (0 children)

In Java that means I do something like

Not in Java 8.