Click here to Skip to main content
15,900,725 members

Survey Results

What are the worst programming habits

Survey period: 7 Jul 2014 to 14 Jul 2014

Inspired by a rant-fest

OptionVotes% 
No comments in code1,05740.95
Terrible variable names1,35752.58
Bad / dangerous code formatting69526.93
Mystery side-effects in code1,07641.69
Using magic numbers64424.95
Leaving commented-out code hanging around too long60923.60
Repeating code (Cut and Paste programming)1,28549.79
Poor program structure1,10742.89
Writing code that assumes a default behaviour67326.08
Swallowing errors95036.81
Not checking input parameters / return values / null testing1,05840.99
Respondents were allowed to choose more than one answer; totals may not add up to 100%



 
GeneralRe: Agile Programming and Refactoring Pin
Nelek7-Jul-14 11:45
protectorNelek7-Jul-14 11:45 
GeneralRe: Agile Programming and Refactoring Pin
Ravi Bhavnani7-Jul-14 11:53
professionalRavi Bhavnani7-Jul-14 11:53 
GeneralRe: Agile Programming and Refactoring Pin
Nelek7-Jul-14 12:00
protectorNelek7-Jul-14 12:00 
GeneralRe: Agile Programming and Refactoring Pin
Gary R. Wheeler7-Jul-14 14:00
Gary R. Wheeler7-Jul-14 14:00 
GeneralRe: Agile Programming and Refactoring Pin
Pete O'Hanlon8-Jul-14 1:46
mvePete O'Hanlon8-Jul-14 1:46 
GeneralRe: Agile Programming and Refactoring Pin
thatraja8-Jul-14 2:25
professionalthatraja8-Jul-14 2:25 
GeneralRe: Agile Programming and Refactoring Pin
Rob Philpott10-Jul-14 22:02
Rob Philpott10-Jul-14 22:02 
GeneralAll, but these two give me sleepless nights... PinPopular
Sander Rossel7-Jul-14 0:02
professionalSander Rossel7-Jul-14 0:02 
Swallowing exceptions and copy/paste programming. They are going to cost you A LOT of time.
I have solves SO many bugs that were almost impossible to solve because no exceptions seemed to occur. You'll be looking for hours trying to find some logical flaw in the code and after hours you realize some (in-house) library swallows the exception that caused the bug... ARGH! When reading the error message the bug is often fixed in a couple of minutes.
A lot of bugs come from copy/paste programming. Either because someone forgot to change a variable name or some such or because code is changed, but not in the copied version (because no one simply knows it's there).

At a close third is probably keeping commented out code in production, it just not so dangerous since it doesn't do anything. I had a colleague who was afraid of code, but even more afraid of deleting code.
The source was littered with commented out code. When I told him to just delete it because we have source control anyway he started making weird faces and noises and I think he changed his pants afterwards...

The only thing I don't consider a bad practice in that list is not writing comments.
I prefer no comments over useless, outdated or misleading comments. I'm a programmer, I'll figure out what the code does. It's my job!
People often forget that every line of comment is just another line of code that needs to be maintained.
On top of that most programmers are just that. They aren't writers. Writing good comments is an art most programmers don't master. Comments get messy and may be harder to understand than the actual code!
It's an OO world.
C#
public class SanderRossel : Lazy<Person>
{
   public void DoWork()
   {
      throw new NotSupportedException();
   }
}

GeneralMisleading comments Pin
Rosenne6-Jul-14 23:24
Rosenne6-Jul-14 23:24 
GeneralAlmost all Pin
Nelek6-Jul-14 22:58
protectorNelek6-Jul-14 22:58 
GeneralRe: Almost all Pin
Gary R. Wheeler7-Jul-14 2:58
Gary R. Wheeler7-Jul-14 2:58 
GeneralRe: Almost all Pin
Nelek7-Jul-14 11:38
protectorNelek7-Jul-14 11:38 
GeneralNone of the above? Pin
SteveTheThread6-Jul-14 22:00
SteveTheThread6-Jul-14 22:00 
GeneralRe: None of the above? Pin
Nelek6-Jul-14 22:36
protectorNelek6-Jul-14 22:36 
GeneralRe: None of the above? Pin
KarstenK6-Jul-14 23:57
mveKarstenK6-Jul-14 23:57 
GeneralMessage Removed Pin
7-Jul-14 2:45
professionalN_tro_P7-Jul-14 2:45 
GeneralRe: None of the above? Pin
Gary R. Wheeler7-Jul-14 3:15
Gary R. Wheeler7-Jul-14 3:15 
GeneralRe: None of the above? Pin
Ravi Bhavnani7-Jul-14 7:30
professionalRavi Bhavnani7-Jul-14 7:30 
GeneralRe: None of the above? Pin
SteveTheThread8-Jul-14 21:34
SteveTheThread8-Jul-14 21:34 
GeneralRe: None of the above? Pin
Mark_Wallace9-Jul-14 17:49
Mark_Wallace9-Jul-14 17:49 
GeneralLong Column Name Pin
Meysam Toluie6-Jul-14 21:50
Meysam Toluie6-Jul-14 21:50 
GeneralRe: Long Column Name Pin
Dan Neely7-Jul-14 2:30
Dan Neely7-Jul-14 2:30 
GeneralNot checking input parameters / return values / null testing Pin
Gandalf_TheWhite6-Jul-14 20:56
professionalGandalf_TheWhite6-Jul-14 20:56 
GeneralRe: Not checking input parameters / return values / null testing Pin
KarstenK6-Jul-14 23:59
mveKarstenK6-Jul-14 23:59 
GeneralRe: Not checking input parameters / return values / null testing Pin
Philippe Mori7-Jul-14 15:53
Philippe Mori7-Jul-14 15:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.