r/java • • Mar 05 '18

Top 10 Useful, Yet Paranoid Java Programming Techniques

http://blog.jooq.org/2015/08/11/top-10-useful-yet-paranoid-java-programming-techniques/
223 Upvotes

105 comments sorted by

View all comments

52

u/AlainBienvenue Mar 05 '18

Like the author, as someone who has been coding in Java since 1999, I do not see anything wrong or even paranoid with any of these. Just good practices.

9

u/youguess Mar 05 '18

I personally hate yoda speak as I have to mentally rework the statement in my head

I like languages which read like normal English (python eg, go to a certain extent) and this breaks the flow horribly in my opinion

1

u/CultLord Mar 06 '18

My first mentor said that I needed use Yoda comparisons (he didn't call them Yoda comparisons) on day 1 of my job and that was just the law of that company's code because of potential NPEs and that I would save lots of time over the course of my career if I followed that simple rule.

After the first few weeks, it wasn't a big deal. And my boss basically lied, because I have fixed many bugs from other programmers that didn't follow the same rule that would have been just fine with a Yoda comparison.

0

u/youguess Mar 06 '18

I just don't believe that.

After all especially in a strongly typed language any sane linter worth its name will catch issues like this.

It doesn't make sense to do an assignment in an if statement for example (in the comparison clause)