58
Corb
8y

"So, how bad is the current code base?"

Comments
  • 4
    Woah... Correct me if m wrong... But if u have jst set the value to be null... Why would u use the if condition altogether.....???
  • 3
    so desperate
  • 9
    @Electrux That's exactly the point. Even the IDE warns about the condition being pointless. But maybe the previous programmer was colorblind, illiterate or simply didn't give a damn about it
  • 0
    @Corb lol sorry m no java developer so idk wat the ide means or something... But yea... Quite prepostrous... And funny... Or as @youness put it... Desperate 😂😂😂😂
  • 3
    @Electrux for some reason i refuse to believe that you get work done in c++ without an ide
  • 1
    @RazorSh4rk how do u say that? And ur kinda right... M truely madly deeply in love with visual c++... Jst makes the work so much more easier with autoformatting and stuff 😁
  • 0
    @Corb that is old code stink. It looks like the if clause was added later, or copy pasted from somewhere else, using an outdated IDE that does not use lint warnings. Or it was a clueless dev from last week...
  • 1
    @Electrux the way I've seen it explained elsewhere is that it future proofs the code.

    If someone comes along a year from now and changes the way the address list gets initialised, the list could potentially be null or could potentially have value, so checking for nullness will protect the app exploding due to an NPE if someone negligent comes along and changes the code without checking where that variable gets used.

    Granted, the two are right next to each other, so it's a lot less relevant here... But that's why IDEs highlight it as bad practice.

    Good old Java, eh?
  • 0
    @theactionslacks But NPEs are pretty much solved by options/optionals and they do it much better...
  • 1
    Optionals dude
  • 1
    @jpichardo In scala they are called options, hence the "/"
  • 1
    Honestly, if that's the worst thing in your code base, it's doing pretty well.

    The horrors I've seen ...
  • 0
    Better be safe than sorry! 😂
Add Comment