NogDog;11040345 wrote:That way I'm always bound to irritate somebody. 🙂
Like me! :mad:
I always put braces on the next line. I find it's much easier to organize code and thus much easier to read. It also lends itself to a literal meaning of "code block" because now the code you have in, say, your if block, actually looks contained within a block. And since I always do it no matter what, my code is consistent.
I do have annoyances when it comes to reading other peoples' code, some of them are coworkers but I try to take a step back and realize they probably think the same way about my code. I just feel like my code is written in such a way as to increase readability and maintainability, whereas others' code is just written to get the job done. But let's face it: we all think our code is the best, and we all like "our way" of doing things. I probably only like putting braces on the next line because that's how I was taught when I first learned programming way back when.
One particular thing that makes me want to gouge out my eyes and eat them, is when each new line has opening and closing <?php ?> tags. This is about as necessary as the Black Plague.
<?php if(somecondition) { ?>
<?php $x = 42; ?>
<?php $y = 69; ?>
<?php } ?>
<?php //end my life ?>
I find this is more of a problem when you have to inevitably mix PHP with HTML, but I have seen it elsewhere too.
My other big pet peeve is no use of white space. You know, when a developer never has an empty line, and you're faced with a wall of code, and your eyes are bleeding because you're trying to decipher it and all you can think is, "You have a damned Enter key for a reason!". No one wants to read a wall of text even in a literary context; it's no different in coding. Use white space, people. Organize your code. Group it. You just may save the next developer who has to work on it from going on a shooting rampage (or yourself, 8 months later and having to look at it again). Alternatively, putting a space (or too many lines, or inconsistently putting lines) between every line can also be extremely annoying. I've seen FileZilla screw up files by doing this. Not sure why it does it, but after pulling down a file from a server and then seeing basically double-spaced lines making a 650 line file into a 1300 line file, I want to close the file and walk away.
I like this thread. 🙂