Back to General discussions forum
Hello all,
I just wanted to try to start a thread about programming pet peeves, so we can share our likes and dislikes. One of my biggest pet peeves is when people write their entire program in the main function/method! It is ugly and you can't see what the hell is going on most of the time! Use functions/methods to organize your code, folks! Main is supposed to be an entry point for our programs, not the entire program!
There, I've made my peace :) Maybe others might have something to share.
-- Christopher P. Matthews
Christopher, Hi!
I was not acquainted with the word "pet peeves" until now... Well... Have a look at these wonderful snippets dating back to 1997 when I've got my first computer:
Well, there are many more files but it requires time to recollect what they all are about... I've uploaded these just for example of how hopeless I was :D
Though I feel extremely nostalgic, my eyes do bleed when I see this horrible stuff... How many "pet peeves" can we extract from there? :)
What I find annoying, is unnecessary complexity. People who are given a simple task and then proceed to create a three-tier multi-layered abomination with WidgetFactoryFactories, Inversion of Control, Dependency Injection, etc. all over the place.
Often, all that "flexibility" is unneeded and will never be used; yet you're still stuck maintaining a thousand line incomprehensible mess for years to come.
I prefer to build "the simplest thing that will work" and then iterate over that to improve it as needs arise.
Hi Christopher,
Please don't look at any of my code, because I prefer to put as much as possible into main. I'll normally only use a function or subroutine when it's going to be called from more than one place.
My pet peeve is no indentation or indentation that isn't sensible. I find that makes it very difficult for me to follow what the code is doing.
I also dislike not following the conventions of the language of choice, i.e. camel case in Python, lower case method names in .NET, and, this goes with any language, but I really, really dislike code that does not put spaces between operators and operands, i.e. "41+1".
Don't get me wrong, I'm still new to the "game"; I'm not slamming other programmers' skills, as there are a great many programmers here that are much, much better than I. But, from my point of view, code should be viewed as art; not only should we pay attention to what a piece of code does and how it does it, but how the code itself is formed, i.e. how the programmer decided to display his work. To me, even though I know that this is not at all linked to how a program performs, but how the code looks is just as important as how it works.
However, at the end of the day, as long as the code does what it's supposed to, who am I to judge?
-- Christopher P. Matthews
i hate it when i make simple mistakes, i was pulling my hair out about p 148, but i messed up the simple last step of the process