Programming Pet Peeves

Back to General discussions forum

Christopher Matthews     2015-08-15 06:26:30

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

Rodion (admin)     2015-08-15 11:20:40
User avatar

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:

  • PIANO - you will easily guess what it is;
  • ROBOTS - I think it is a kind of console game based on exercise from Jacques Arsac book.
  • SHADOCK - another game on abother exercise from the same book - looks like I already learned a bit about subroutines :)
  • STUDIENT - you will like it's style (sarcasm) though it is hard to guess its purpose - it draws a kind of programmable calculator and allows programming of very primitive sequences of operations (e.g. calculating square root with Heron's formula).

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? :)

Guy Gervais     2015-08-15 15:45:25
User avatar

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.

Quandray     2015-08-16 11:32:53
User avatar

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.

Christopher Matthews     2015-08-21 08:53:36

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

smwentum     2015-08-22 12:48:31

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

Please login and solve 5 problems to be able to post at forum