44
Rikan
7y

Just looking at code, my colleague ("Senior Java Developer"), wrote...

if (process == "null") {...}

As you can guess, process is a String.

I just don't know what I can tell him. It's just so wrong, in every possible way...

Comments
  • 0
    I'm so much NOT into javascript, that I forgot how to actually check for null... Is typeof still a thing?
  • 14
    @naghen It's Java, not JavaScript, but you have use .equals() to do a comparison like that. Usually, this is something you learn in the first Java lesson
  • 1
    First step: check the codebase for more of it.
  • 5
    @Rikan I know how you feel. Just yesterday I explained to one of my 'senior' colleagues what java beans are :s He is supposed to have 15 years of experience in java??
  • 0
    @Rikan ok, thanks :)
  • 2
    @wilhelmina Java beans are what Java coffee is brewed from, right? ☕
  • 0
    For fuck sake! I'm a hardcore C# dev and have done some Java now and then but absolutely no senior Java dev. But even I know what your fellow 'senior' dev does is wrong. Senior in what? Age probably??
  • 2
    It's not even null safe! #punintended
  • 1
    @naghen that’s some high quality satire there friendo.

    @Rikan mistakes happen and seniors sometimes take aaaaages away from an IDE.

    But yeah, I would have ripped him for it then shown him so he knew what to fix.
  • 1
    Thanks everybody! That's the reason I love DevRant, no matter what crazy stuff you see, there are always people that have seen something similar and share some nice words!

    @Zennoe in short: you use == to check if the objects are the same, that works perfectly with primitives, but if you want to check if the content of the objects is the same, you use equals().

    @vlatkozelka That's true! But it looks that it's far to easy to ignore the hints, the IDE provides. Maybe I should suggest that he uses Notepad++ if he doesn't plan to use the features IntelliJ provides, so we can save the money for his license...
Add Comment