Good programming practice

Jun 9 2020 11:24 AM
Hey guys
 
I have a continuous dialog with my developers about Good programmering practice and not all get it.
 
Please take a look at this piece of code below. I my oppinion this is badly written code because:
  • Unnessecary negation of the conditional statement can lead to confusions.
  • The negation makes an ekstra operation.
  • Obviously dead code since "return" can be avoided.
Obviously you should not negate and instead do the "this.updateTrans(); ok = true;" inside the if statement. This way it's much more readable by human eyes.
 
What are you guys oppinion and arguments on this?
 
Thank in advance. 
 
 

Answers (3)