12 common programming mistakes to avoid

Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy.
This forum is not for asking programming related questions.

Moderator: General Moderators

Post Reply
sunilbhatia79
Forum Newbie
Posts: 24
Joined: Sun Nov 11, 2007 9:37 pm
Location: Mumbai, India

12 common programming mistakes to avoid

Post by sunilbhatia79 »

User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Post by onion2k »

That's a pretty good list.
User avatar
Kieran Huggins
DevNet Master
Posts: 3635
Joined: Wed Dec 06, 2006 4:14 pm
Location: Toronto, Canada
Contact:

Post by Kieran Huggins »

indeed it is.

Refactoring and unit testing often need to be sold to the client as a strength of your design methodology. Everyone always wants it now for cheap, but only because they don't understand the implications of what they're buying. It's our job as developers to help educate the client in this field. I won't waste time with the wrong clients anymore, there are enough good ones out there if you're patient.

Analogies are often helpful in this regard.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

That is a pretty decent list.
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Post by Christopher »

It is a good, but odd list. I can't tell if it is just a list of good ideas, but in being a little hasty, missing a bunch of others. Or is it a little out of date? It certainly misses the impact that Agile has had on programming -- testing, refactoring, peer review, CVS, etc. would be on a primary list, with things like indenting and comments on a secondary one.

I guess it is a good list of common mistakes.
(#10850)
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Post by superdezign »

Those don't exactly seem like "common" mistakes to me, but moreso mistakes that come from inexperience.
User avatar
shiznatix
DevNet Master
Posts: 2745
Joined: Tue Dec 28, 2004 5:57 pm
Location: Tallinn, Estonia
Contact:

Post by shiznatix »

I agree with those but I must say that I don't do things like unit testing. I am also really bad at commenting code but I have been trying to go back through a lot of my code at my current job and put in nice comments. I just don't see how unit testing is that amazingly important, just seams like it catches small errors that should be caught when testing your code in the first place.
User avatar
Maugrim_The_Reaper
DevNet Master
Posts: 2704
Joined: Tue Nov 02, 2004 5:43 am
Location: Ireland

Post by Maugrim_The_Reaper »

I just don't see how unit testing is that amazingly important, just seams like it catches small errors that should be caught when testing your code in the first place.
The problem is one of consistency. I want to be assured my code does Use Cases #1 to #1000 without manually checking every single one for errors. So an automated testing suite is a huge time saver (and less prone to dodgy manual testing and setup). In my experience you catch a lot more than small errors - you catch some pretty bone crushing ones early enough to fix them silently before anyone else notices ;). At the end of the day, if you're not continuously testing code you can't say confidently everything works as you expect unless you manually check every one. Been there, eats up too much time and effort (as well as being dead boring) and never liked sitting on my hands waiting for the inevitable bug reports to be filed.

The other side, is using preemptive test/spec (TDD or BDD) writing to describe examples of how each small piece of unique behaviour should work from my preferred theoretical public API, so I know what's what before I even start implementing it, and in such a way anyone else reading these examples can pick it all up easily afterwards and have a safety net to catch their mistakes. Probably one of my three main reasons for being so fascinated with BDD these days - BDD specs tend towards being more readable than xUnit tests.
Post Reply