Zen of Defensive Programming: One operation per line

After discussing the evils of ternary operators in my last installment, let’s extrapolate a little from that last example. Just as a reminder, I had exploded a single line of code into a much more readable and maintainable code block. It is probably best expressed in a simple, single rule.

Only have one operation per line!

To me, this almost goes without saying. However, as I look at other people’s code, it reminds me again and again, just how blatantly programmers will abuse their languag...

 •  0 comments  •  flag
Share on Twitter
Published on June 01, 2022 08:00
No comments have been added yet.