Click here to Skip to main content
15,114,611 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%



 
Generalconcise guidelines, supporting tools, awareness Pin
Andreas Gieriet13-Jul-14 22:24
professionalAndreas Gieriet13-Jul-14 22:24 
GeneralHow about creating function in order to run a simple query Pin
Mohibur Rashid13-Jul-14 18:00
professionalMohibur Rashid13-Jul-14 18:00 
GeneralC is the worst Pin
John Underhill13-Jul-14 7:22
MemberJohn Underhill13-Jul-14 7:22 
GeneralRe: C is the worst Pin
Mohibur Rashid13-Jul-14 17:57
professionalMohibur Rashid13-Jul-14 17:57 
GeneralRe: C is the worst Pin
Andreas Gieriet13-Jul-14 22:13
professionalAndreas Gieriet13-Jul-14 22:13 
GeneralRe: C is the worst Pin
Austin Mullins14-Jul-14 9:41
MemberAustin Mullins14-Jul-14 9:41 
GeneralOh , Hai Pin
sloppy slim12-Jul-14 23:20
Membersloppy slim12-Jul-14 23:20 
GeneralInteresting selections made Pin
Dennis E White11-Jul-14 9:26
professionalDennis E White11-Jul-14 9:26 
GeneralRe: Interesting selections made Pin
Adam David Hill11-Jul-14 14:28
professionalAdam David Hill11-Jul-14 14:28 
I'd say it's because the execution is only one of many important aspects of software. If you run your source code through an obfuscater it may become next to impossible to maintain afterwards. The software may execute perfectly, but if it cannot be maintained then in most cases it no use in the long term.

As for the other options, there may be specific cases where some of the others are acceptable. A trite example, but take a method which returns the centre of a Rectangle based on coords and size. Somewhere in there it's likely to have something like "width / 2". The "2" is a magic number, but replacing it with a constant is worse than leaving it as is, as what would you call it in order that it reads better than the literal value?

I don't know about the worst variable name, but as for how bad a method name can be, I did encounter GetVodka and GetWhiskey in an enterprise data procedure. Nothing to do with beverages, and nothing was returned. Instead there were hundreds of lines of procedural SQL making complex and seemingly unrelated manipulations on various datasets. Of course this was bad for a number of reasons, but if the name expressed what was intended the maintenance would have taken a fraction of the time. There's an argument there for documentation, but good names can actually be the documentation a lot of the time for the detail level stuff.
GeneralDue to Variable naming .... i, j ,k ..... Pin
RhishikeshLathe9-Jul-14 23:17
professionalRhishikeshLathe9-Jul-14 23:17 
GeneralRe: Due to Variable naming .... i, j ,k ..... Pin
Dávid Kocsis10-Jul-14 0:58
MemberDávid Kocsis10-Jul-14 0:58 
GeneralRe: Due to Variable naming .... i, j ,k ..... Pin
thatraja10-Jul-14 3:13
professionalthatraja10-Jul-14 3:13 
GeneralRe: Due to Variable naming .... i, j ,k ..... Pin
Andreas Gieriet10-Jul-14 9:44
professionalAndreas Gieriet10-Jul-14 9:44 
GeneralRe: Due to Variable naming .... i, j ,k ..... Pin
Karen Mitchelle10-Jul-14 17:04
professionalKaren Mitchelle10-Jul-14 17:04 
GeneralCopypasta Pin
Jason Hutchinson9-Jul-14 6:15
professionalJason Hutchinson9-Jul-14 6:15 
GeneralNot learning the art of programming Pin
Shameel9-Jul-14 6:06
professionalShameel9-Jul-14 6:06 
GeneralMost of the above options ends up with "Mystery side-effects" in code Pin
Ravimal Bandara8-Jul-14 22:35
MemberRavimal Bandara8-Jul-14 22:35 
GeneralAbout the 1st option PinPopular
thatraja8-Jul-14 3:24
professionalthatraja8-Jul-14 3:24 
GeneralSpend more time with code cleanup Pin
Swinkaran7-Jul-14 14:24
professionalSwinkaran7-Jul-14 14:24 
GeneralRe: Spend more time with code cleanup Pin
Kornfeld Eliyahu Peter7-Jul-14 21:40
professionalKornfeld Eliyahu Peter7-Jul-14 21:40 
GeneralRe: Spend more time with code cleanup Pin
Keith Barrow8-Jul-14 0:25
professionalKeith Barrow8-Jul-14 0:25 
GeneralRe: Spend more time with code cleanup Pin
PIEBALDconsult8-Jul-14 7:42
professionalPIEBALDconsult8-Jul-14 7:42 
AnswerOh, I checked them all because .. PinPopular
MacSpudster7-Jul-14 8:21
professionalMacSpudster7-Jul-14 8:21 
GeneralDesert island discs code Pin
Duncan Edwards Jones7-Jul-14 8:04
professionalDuncan Edwards Jones7-Jul-14 8:04 
GeneralRe: Desert island discs code Pin
Swinkaran7-Jul-14 14:27
professionalSwinkaran7-Jul-14 14:27 

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.