Well, I found old code from a C++ class project in 1997 (first year uni)
That cursed indentation style 😱
The Variables With Capital Letters!
Calling a destructor directly to clear an object (lolwut)
I'd put in more spaces too.
(pretty sure the variables names in French and the "over-comment everything" requirements were required by the teacher)
@hotkey Je code encore mes noms de variables et de fonctions en français. Ça me permet de rapidement différencier mon code du code de librairies externes.
Bon, évidemment, c'est toujours quand c'est pour des projets à l'interne, hein...
@hotkey@rick
I haven't collected appalling code styles in a while, unfortunately. Got out of the habit when I stopped reading other people's code. But let's just say that I once saw C code with no indentation at all, and have also seen it with very few line breaks in blocks because this person apparently never wanted anyone to read their code again. I'm not sure what those styles are called but they're like trying to read illuminated manuscripts from before the invention of spaces between words.
In all seriousness, I don't really care what style people use (mostly), I just find Allman to be the most navigable. I learned K&R from the K&R book, but once I found Allman it just stuck with me. But I write verbose code because I don't have to fit it onto a floppy disk anymore. Idgaf about including extraneous whitespace. It's not in short supply.
@hotkey@rick
In fairness, back in the bad old days of the web, coding that way also made a difference in load times, but minifiers came along pretty quickly and yeah, now you've got no excuse.
I once heard a rationale that every line of code should be a semantic whole, and therefore blocks should all be on one line. This has the benefit of cutting down on the levels of block you use, but it's still unreadable.
And you'd probably hate my code because I write a fair number of Java-style variables. No Hungarian notation though. Autocomplete is my friend.
@hotkey
Tabs are only dead if we allow them to be. They'll stage a comeback any day now 😜
I see the advantages to both styles, but for me K&R boils down to avoiding an extra line in your program, and again, I like whitespace. Allman putting the opening and closing bracket on the same line makes it slightly easier for me to scan for them. I admit that a good IDE should do that job for me, but I still prefer it slightly. I do admit that K&R puts the statement that initiates the block on the same line as the closing bracket, which makes a certain degree of sense. But I can read both without difficulty.
@hotkey Speaking of overcommenting, in uni the embedded C teacher required us to use verbose names in Systems Hungarian notation for everything, even for simple loop counters. So even a single-line-body for loop looked like this:
Add comment