share
Stack OverflowWhat's your favorite "programmer ignorance" pet peeve?
[+395] [0] Michael Borgwardt
[2009-01-08 10:39:31]
[ language-agnostic polls knowledge ]
[ http://stackoverflow.com/questions/423823] [DELETED]

What are, in your opinion, the worst subjects of widespread ignorance amongst programmers, i.e. things that everyone who aspires to be a professional should know and take seriously, but doesn't?

(1) brazzy: Can I suggest that you add your personal peeve as an answer so people can comment on that separately to the question itself? (+1 on that, btw.) - Jon Skeet
good idea, will do. - Michael Borgwardt
(32) I've just seen the word "single" in the question. Does that mean I shouldn't have submitted 5 answers (so far)? - Jon Skeet
(197) @ Jon Skeet - That would be the pet peeve of coding a solution before understanding the requirements? - Dan Malkinski
@Dan Malkinski: +1 for the comment (in spirit, of course) - P Daddy
hahaha... me too! me too! +1 @Dan Malkinski. - vmarquez
(57) Of course we all know that when Jon Skeet codes the requirements re-write themselves to match his output. :-) There must be a bug in SO because the question hasn't changed... - Dan Malkinski
+1 as it makes it reach 100 up votes - willcodejavaforfood
(2) I can't believe someone tripped the skeet in a lol net. +1 for that (because the skeet "rulz") - Kris
(15) @Dan Malinksi: but is has, look again ;) - Joel Coehoorn
(2) Could arrogance be substitied for ignorance in the question and the answers are still true? Possibly. ;) - JB King
(12) Just being a pedant, but if it is a 'peeve', surely the word 'favourite' is a bit misplaced - johnc
(1) @lagerdalek - my favourite "programmer ignorance" pet peeve is pedantism ;) - Cocowalla
(1) @johnc - if it's a pet peeve often found in others as opposed to a personal peeve, it can certainly be a favourite. - FerretallicA
(3) This is a great learning question. - Jeff Davis
@johnc - I think it's along the same lines as "things you love to hate". Whatever that means. - LarsH
This was an awesome question. Really enjoyed reading through all the answers! - Utkarsh Sinha
[+5] [2009-12-22 00:09:07] Dave Quick

Related to perf:

  1. Lack of people using profilers of any sort or really understanding where their code (or sql queries) spends the most time and instead just randomly stabbing in the dark and hoping to hit on the "right thing" tht improves perf. "Measure, measure, measure." = Before making change you should measure. As you're hacking a solution that is "better" keep measuring. After you integrate and release to pre-production you should measure.
  2. the fact that people get serialization / deserialization happy without realizing the costs of it. String manipulation can (and often does) consume a majority of the time on a lot of apps I used to be called in to performance troubleshoot for folks while consulting. WOrks hand in hand with lack of profileing - people seem to always be astonished at the amount of time string processing takes in their apps. If you've got a homogenous story on your backend take advantage of it... for instance if you're using a SOA and you're completely 100% .net inside your own apps in your backend then using binary serialization rather than soap/etc. can be a winner for you.... yet for some reason people seem to equate SOAP/xml as "right" and everythign else as "wrong". Yes - for internet and partner facing things - SOAP/REST/etc. makes a heck of a lot more sense but if you're using the services internally... come on.
  3. Filter / reduce data as close to the data as possible. If you're pulling back a big chunk of rowset data simply to get a count of items you're doing something bad. Learn to issue a COUNT(*) in SQL. ;-)
  4. Remember tcp/ip round trip acks will kill your perf - send less data and need feewer acks = faster end user percieved perf on web sites. No rocket science there. Not setting etags, not allowing user caching of files, forcing authentication for static files that could/should be anonymous access enabled, etc.... read any of the dozens of faqs on stack overflow, codeprojects, msdn, etc. etc. and you'll find the same set of recommendations.

Related to new folks without history or experience in the industry (this is new programmers or "the business guys"):

  1. "Development of this {product | site | technology} would go faster if we did it in {rails | php | mysql | python | perl | etc.}" - when they don't know more about the language/environement/technology they are suggesting than some blog post they read on techcrunch. Hint: ask a mentor - you might be onto something. You might be sticking your foot in your mouth.
  2. "we should buy {company | product | technology} and drop it into {current project} to speed up the development" when no one speakign knows the cost of integration, interoperability with exiting solution, or the relative cost of implement vs. buy. Hint: ask a mentor - you might be onto something. You might be sticking your foot in your mouth.

Surprises me how often these repeat.


1
[+5] [2009-03-30 13:40:20] karim79

I have many, but this one makes me want to hurt myself:

"...but it was working before."


As an extension to this, "You must have broken it, because before I merged in your changes, it was working!". But thinking about whether my "correct" changes just unhide bugs he/she made would be out of question ... sigh. - phresnel
2
[+5] [2009-04-05 14:24:58] ssakl

Programmers who do not unit test their code and then get upset with QA when bugs are found which obviously demonstrate this fact.


3
[+5] [2009-05-13 12:22:33] TM

When people say "Oh, this is so simple, I know it works, there's no point of writing a test for it".

They are completely missing the point of the test, it isn't just to verify that it works, it's to verify that it still works when people make changes down the road.


4
[+5] [2009-05-13 12:27:45] pomarc

Ignoring the latest community libraries/techinques, and continuing to develop software the way people did ten years ago.


(5) In my experience with large companies, you can count yourself very lucky if techniques are only 10 years out of date. - Michael Borgwardt
(1) Good point, however, sometimes the difficulty of code maintenance, particularly on legacy systems, can affect how you attack the code. Michael Feather's "Working Effectively with Legacy Code" recognizes that a system that "can't be easily thrown into a test harness" can force the developer to proceed in a less than optimal manner. This does not mean the dev should not attempt refactoring, but time constraints, cruddy massive systems, and clueless leaders being what they are, sometimes driving another mile before getting the oil change is an acceptable approach. - Bernard Dy
(1) Hmm. Not all of the latest techniques are necessarily that great... though not-invented-yet is probably not a good attitude unless the technology in question is, in fact, not ported to all your target platforms yet... - SamB
5
[+5] [2009-06-02 15:35:00] Chocolim

People who know only one language, that "can do everything". And every problem they face as if they are using their "can do everything" language and never stop to see what else can bee done in the others paradigms.


6
[+5] [2009-08-26 00:23:57] Johannes Schaub - litb

In C++:

Myth: NULL is not always zero, but it depends on the null pointer address.

Reality: NULL is always zero, and it's not an address. It's an integer.

Many confuse NULL with an address, and think therefor it's not necessarily zero if the platform has a different null pointer address.

But NULL is always zero and it is not an address. It's an zero constant integer expression that can be converted to pointer types. When converted, the pointer created is called a "null pointer", and its value is not necessarily the lowest address of the system. But this has nothing to do with the value of NULL.


(1) Myth: NULL is always zero, and it's not an address. It's an integer. Reality: NULL is either 0 or (void*) 0, depending on the implementor's choice. (Or any other expression that evaluates to one of these at compile time.) - Windows programmer
(1) @Windows programmer, No in C++ it is always an integer, never a pointer expression. It's got a reason i didn't include C into it. So if you think it deserves an entry for C about it with that wording - go for it. But this comment section is the wrong place. - Johannes Schaub - litb
(1) I just checked and you're right. I wasn't trying to put my comment in the wrong place, I hadn't noticed that C++ differed from C on this matter, and my comment was wrong for what it says. Maybe we should publish an article in a scholarly publication. "C considered harmful, for C++ programmers" :^) - Windows programmer
Good idea hehe xD - Johannes Schaub - litb
@Kevin, That faq is a C FAQ. I'm not sure why you post it to my answer as a comment. Either you think my answer is wrong (but then you should have downvoted me), or you think my answer is right and the FAQ is helpful - but it isn't because it's not about C++). My Pet Peeve is about C++, to keep it clear and so that my pet peeve doesn't always need to say ".. except when it's `(void*)0 ... etc". - Johannes Schaub - litb
Your answer is right. The FAQ page explains more about this NULL versus zero business. It's simply the best page I could find on the issue. Memory addresses work the same way in any language -- assembly, C and C++ . - Kevin Panko
To be really anal about it, "NULL" is not a part of the C++ language at all. The file, stdlib.h, #define's NULL to be 0 when __cplusplus is defined. You can cut out the middleman and just write 0 anyplace you would write NULL, and it works exactly the same. It's just conventional not to do it that way. - Kevin Panko
@Kevin, that is right and i agree. It's not part of the core language. But it's still specified as being part of C++. In this way, it's part of the language's library. To be further anal about it, NULL can be defined as 0L, '\0' or any other zero value - in this way, 0 and NULL are not always completely identical, and it's allowed in C to have NULL be 0 too. The matter is more difficult in details, so i omitted the C side of this on purpose, because i wanted my answer to be a rough overview, not a detailed specification :) - Johannes Schaub - litb
(1) Use nullptr. NULL is simply broken... - Andreas
7
[+5] [2010-10-06 18:28:15] Dustin Martin

Programmers that think they don't need to consistently indent code and make it as readable as possible for the next developer.


Yeah, especially when you just know there must be a tab-width that will make things actually line up, but can't figure out what that is. - SamB
8
[+5] [2010-05-01 20:10:50] Wallacoloo

It continues to amaze me how many people believe that:

All programming languages are fundamentally the same; they just use different syntax.


Well, all computer languages certainly are the same—in the same way that all human languages are the same. The things that make them so have precious little to do with syntax, or even paradigm. - Jon Purdy
(3) DV, If they are turing complete languages they are the same! The only differences are the tools the languages have available. - Chris Marisic
(4) @Chris The statement above is annoying since it is only true in a narrow theoretical sense, but is used in a broad range of discussions where it doesn't apply (e.g. choice of language for a project). By the same token, all computers are the same, but you won't host a website on a TI-83. - dbkk
(1) @dbkk: you don't want to... but you could :) - nico
(3) @dbkk: Agreed. It is not true even in a theoretical sense. Only heavy qualification could make it true. This is the heavy-handed reductionist paradigm: Let f(x) = what I think is important about x. If f(x) = f(y), then x and y must be the same! @Chris - All people are the same if they have 4 limbs! The only difference is their faces, their voices, their actions, their goals, ... etc. etc. - LarsH
9
[+5] [2010-04-17 02:35:05] Jon Nadal

Jumbo Methods

I can't stand "jumbo methods," often characterized by:

  1. no extracted helper methods (but you might get block comments if you're lucky)
  2. dozens of variables in scope (rather than limiting their scope by extracting methods)
  3. no clear separation of tiers (e.g. intermixed validation, persistence, and presentation logic)
  4. control-flow hell

e.g.

void DoIt() {
   // if the view is valid
   if (TextBox1.Text != string.Empty && ...) {
       var sum = 0;
       // process each element
       for (var i = 0; ... ) {
           // make sure it's a good element
           if ( ... ) {
               Status.Text = "Bad Element";
               break;
           }

           // process each subelement
           for (var j = 0; ... ) {
                // add to the sum
                sum += ...
           }
       }
       // remember the sum
       ViewState["sum"] = sum;
   }
   // if the view is not valid
   else Status.Text = "Required field missing";
}

(1) I don't understand why this got -1 because it's a very valid and commonplace situation. This is how code becomes unmaintainable, one method or variable at a time. "Getting the job done" is not the whole story, and leads to spaghetti code. - smci
It is good to remember that usually when you get down to more than 3 nested conditionals or loops, it is time to refactor and break down the function into helpers. I once did this with a more than 100 line method and made it so that I never went further than 1 nested level. - Earlz
@Earlz: I couldn't agree more. - Jon Nadal
10
[+5] [2010-03-21 06:46:43] Chris Johnsen

Any form of cargo culting [1] ( programming [2], general computer usage, etc.).

  • “Hmm, the result still has “>” thingies in it. I guess I have to add yet another decoding pass.”

    Take the time to understand the involved specifications and standards to find out whether this is a bug in the content the program is consuming, a bug in the standard, a bug in the specification, or a bug in some other part of the system. If the data is supposed to be free of character entity references at this point, then there is a bug somewhere (unless the bug is in the specification and it really is OK to have character entity references at this point!). Find the bug to understand the problem.

  • “Hmm, that did not work. sudo worked on this other thing I was doing, I guess I will try it here, too.”

    The solution to every permission problem is not “do it as root”.

Do not “paper over” the immediate problem with the first thing that comes to mind. Solutions from one problem should not be automatically applied to any other problems unless the solution will solve the problem in all applicable situations.

Getting a solution from “the Internet” is fine, but do not blindly apply it. Read the documentation, read the code, do some research, experiment in temporary environments. Learn from the given solution. Do not parrot it. Only with a proper understanding of a particular solution can one determine whether it is a proper solution for a specific problem.

[1] http://en.wikipedia.org/wiki/Cargo_cult
[2] http://en.wikipedia.org/wiki/Cargo_cult_programming

11
[+4] [2010-04-17 03:22:14] harpo

jQuery != javascript

I see a lot of questions around here saying, How do I do X in jQuery, even when the OP has no idea whether jQuery is relevant.

This has elements of other answers: fanboyism, and using frameworks that you don't understand.

There are some great answers at the top! This really is just a personal pet peeve.


Well, maybe they were just hoping that jQuery would make it easier. A reasonable thing to hope in many cases, I think -- I certainly find it handy for screwing around with the DOM in my day-to-day browsing ;-) - SamB
@SamB, don't get me wrong, I love jQuery, and I hope some of its features are built into future versions of javascript. I just see a wave of folks who apparently don't know the difference and who (already) seem to think that jQuery is javascript. - harpo
More than that I hate when someone asks "How do I do xyz" and the reply is "Well, if you used JQuery it would be easy". As if you couldn't do anything without it... meta.stackoverflow.com/questions/45176/… - nico
12
[+4] [2010-09-03 13:03:01] mR_fr0g

The belief that other coders are incompetent.


(2) "The belief that other coders are incompetent." Fixed. - Jim Schubert
ha ha. Without auto-complete i am incompetent. - mR_fr0g
haha, me too. I just couldn't pass up an easy fix ;) - Jim Schubert
13
[+4] [2010-05-12 17:26:11] Earlz

Pointless Tables and ASP.Net controls

Example: clean, functional code

<div>
  I is in your browser
</div>
<div>
  Showing your static text
</div>

Horrible beyond belief code

<asp:Table ID="table1" runat="server">
  <asp:TableRow ID="row1" runat="server">
    <asp:TableData ID="data1" runat="server" Width=191px>
      <asp:Panel runat="server" ID="pnl1">
        <asp:Label runat="server" ID=lbl1" Text="I is in your browser" />
      </asp:Panel>
    </asp:TableData>
  </asp:TableRow>
  <asp:TableRow ID="row2" runat="server">
    <asp:TableData ID="data2" runat="server" Width=191px>
      <asp:Panel runat="server" ID="pnl2">
        <asp:Label runat="server" ID=lbl2" Text="Showing your static text" />
      </asp:Panel>
    </asp:TableData>
  </asp:TableRow>
</asp:Table>

14
[+4] [2010-10-27 17:45:02] John

What bothers me the most is people who code to just accomplish a task without putting even a minimal amount of thought into planning what they should do.


(1) It's like speaking without taking time to form a coherent sentence. - palswim
15
[+4] [2010-09-23 14:08:58] BradB

Listening to ASP.Net (VB) developers with several years experience comment that they cannot work with a particular application because it is written in ASP.Net with C# and they "don't know how it works".


(1) And vice-versa ^_^ - Pondidum
I’ve actually never encountered this in the reverse context! - BradB
16
[+4] [2010-12-07 11:54:55] Khainestar

I got a new one. From a coder I worked with recently.

What do you mean standards?

He didn't know what W3C was, how to write compliant code and had database columns listed as "unecrypted_password". I die a little inside each time I meet people like this and find that they get paid more than I do. :(


I've had the same feeling few times, then I remembered "Imagination is more important than knowledge" ... - THEn
17
[+4] [2010-12-21 07:24:09] tletnes

Assumption that your program/driver/code is important to the user.

The user wants to check their e-mail, watch videos, listen to music, write their novel. They do not want to know that your program just finished re-evaluating its network connection, and now has the ability to launch sheep to mars.

The user does not want to memorize all of the rules that your program requires to run correctly, and they certainly do not want to learn to program some new and truly inventive language just to fill in a config file.

The user does not want to wait while you eat all of the resources building a pretty icon cache.

The user just wants to jump on, check their e-mail and leave.


18
[+4] [2009-06-30 21:16:45] user116330

Ignorance of one's own limitations. I can't stand it when someone thinks they know everything there is to know about a topic and give useless or harmful "advice" to someone else.


Ah... Second Order Incompetence. Nasty one that! It's so difficult to get those that are suffering from it to realise it. - Colin Mackay
19
[+4] [2009-03-29 06:01:48] Vulcan Eager

Comparing floating point values from different calculations without using an epsilon.

Example:

if(sin(x) == cos(y)){ /* do something */ }

instead of

/* here epsilon is taken as 0.001 */
if(abs(sin(x) - cos(y)) <= 0.001){ /* do something */ }

Can you give an example of how you'd do this? - p.campbell
(1) Hmm, wouldn't it be better to use a named constant rather than embedding a magic number? (Presumably "epsilon" would be part of the name.) - SamB
@SamB - I agree completely. - Vulcan Eager
Well said! Float point operation is generally misunderstood. - Juliano
20
[+4] [2009-05-13 12:24:44] call me Steve

People who think "Real-time" is fast.

Usually it takes more time to make sure that tasks are achieved in time.


but real-time things work better if they are fast. - Behrooz
21
[+4] [2009-08-14 12:19:52] Molex

My pet peeve is poor variable naming! Having spent some time as a maintenance programmer, I can tell you that poor variable naming is pure Hell! You should never name things after yourself, after your pets, or after anything that does not relate to what it is and/or what it is doing in your code! I should never see anything like:

if (john == 0){
     return fido;
else
     return fluffy;

5 days from now, no one will know what you were doing, let alone 5 years from now!


(1) I've seen a lot of this in my previous job- names like (php) $specialCustomerNameBratwurst... and there were much longer names, I can't just remember all of them :) - stefita
There really ought to be a sniglet for this syndrome. I maintain code which uses variable names i, ii, iii etc. That is the mark of a recovering fortran programmer. I try to name the variables and function names in my implementation plans, so as not to grind to a halt, when in coding flow. - EvilTeach
(1) We had a developer that used names like Fizzle Fazzle and Fuzzle. When we were trying to debug a problem in the code, we had to go to him and ask what these variables represented. We also asked why he'd chosen arbitrary names for his variables. His response was "well, it really doesn't matter, does it?". I wanted to shout at him "WELL WE'RE HERE ASKING YOU NOW INSTEAD OF FIXING THIS BUG, AREN'T WE?" - Scott Smith
@Scott: maybe you should have sent him back to FizzBuzz ;-P - SamB
@stefita: wow! that's two different variable name syndromes -- the way-too-long syndrome and the "might as well have called it x" syndrome. (Actually, I do call a lot of my variables that -- mostly when they don't mean much in the context of the function I'm writing.) - SamB
22
[+4] [2010-01-18 13:04:12] Wix

Humility. Eric Evans said it in his forward to Jimmy Nilsson's book Apply Domain Driven Design and Patterns, the best coders have the rare combination of self-confidence and humility.

I find many developers have plenty of self-confidence however do not take well to good criticism. Dunno whether this can be blamed on ignorance of human nature.


23
[+4] [2009-01-08 13:06:48] porneL

"It seems to work for me, so I won't bother reading manual/specification to do it correctly"

This is why HTML, JavaScript, feeds and HTTP (caching, MIME types) are in such sorry state.


i for one have better stuff to do than reading specifications the whole day. although i do spend half of my day reading specifications ... but at least my gf gets angry at me for it! and she's right! - nes1983
Careful what you wish for. The internet wouldn't exist if browsers refused to render invalid HTML. - Ian Boyd
@Ian: I'm not advocating draconian error handling. I understand people can't be forced to comply this way. I just wish they'd engage their brains when copying&pasting someone's code, e.g. you won't find a single correct "how to send file from PHP" snippet on the net! Everyone puts a few made-up or self-contradictory HTTP headers in there. - porneL
24
[+4] [2009-01-20 20:52:52] Joshua Carmody

Ignorance of the principles of reusable code and parameters. A ColdFusion developer I inherited code from had made several pages with names like getWallProducts.cfm, getFloorProducts.cfm, getCountertopProducts.cfm, getBacksplashProducts.cfm, etc. Each of the pages was absolutely identical except for the WHERE clause in one SQL query.


I see a lot of this. Pulling those out can be one of the first steps in an awesome refactor. My eye actually pulls towards blocks of code that has a similar outline--instant refactoring fun. - Bill K
25
[+4] [2009-03-29 03:20:20] Trey Stout

Bad or incorrect knowledge of data structures.

"I need to find all untranslated strings in our source. I'll just build an array of all the strings, copy it and compare them to eachother."

Congrats on your n-squared solution. Some folks with modern CS degrees don't even know what a hash-map does. Or why you would ever use one as opposed to an array or list etc...

Drives me nuts.


really? they only briefly touched on it in my school, but they did go over it. what bugs me more is all these CS buggers that have no interest in programming beyond school. - Mark
Why not just build one array, sort it, and check to see if any two consecutive entries match? - Robert L
26
[+4] [2009-01-27 20:28:44] aesdanae

Copying code from another application they've worked on containing the functionality they want to use, and not changing the variable names (that only make sense in context of the original application) because "the client will never see the code."

Oy. Do I try to explain that the client can and will see the code in any variety of instances, or that this will drive fellow team members crazy/confused, or that the PM will have a conniption when she requests full documentation of the system and sees processes named after other clients' products?


27
[+4] [2009-01-09 02:42:00] Ben Daniel

Displaying a message box instead of raising an exception when a method fails to do it's job. For example, a Save() method in a Form simply showing a message box, instead of raising an exception, because the user hasn't filled in some required field, etc.

Because they don't raise an exception, any code calling the Save method has no freaking idea that the Save failed or why it failed!

Typically at this point I'd expect at least one person to say that exceptions should be used "exceptionally", i.e. rarely. If you follow this philosophy then you still need some way to tell your calling code that you failed, which results in changing your method signature so it returns failure details either as a result or an out parameter, etc. And of-course your calling code will need to tell it's calling code that it failed and so on. Ahh hello world, this is exactly what exceptions are built for!

Maybe this thinking doesn't work in all frameworks (like web, etc) but in Delphi Windows applications it's perfect as unhandled exceptions don't crash the application, once they travel back to the main message loop the app simply shows a presentable message box to the user with the error details, they click OK and program flow continues to process messages again.


For more details, see my blog post on this subject: bendaniel.name/2008/04/raising-exceptions-for-invalid-user.html - Ben Daniel
(1) You should create 2 different functions: one to validate and one for saving. Shorter functions and no hassle to figure it out why is was a problem - PoweRoy
@PowerRoy: Splitting your code up doesn't get around this fundamental problem. This is difficult to explain in a 300 character comment (this is my 5th attempt and I'm giving up now, lol) but suffice it to say if you follow my link hopefully you'll understand. :) - Ben Daniel
Another way to put this is that you have to know at what level to convert from an exception to a dialog. Some people choose too early. - Bill K
28
[+4] [2009-01-09 05:59:36] Timur Fanshteyn

Overengineering, usually to make unnecessary optimizations.

These are usually done by seniour developers. These usually add a lot of complexity with adding minimal (if any at all) speed improvements. What's worse, is that after these are done, someone other unlucky developer gets stuck with the "optimized" code.


29
[+3] [2009-01-09 00:37:22] community_owned

Programmers that have absolutely no idea whatsoever what "malloc" means/refers to.


30
[+3] [2009-01-09 12:51:10] Riho

So far in my years of development I have found that I resent most those programmers who can't keep deadlines. It's OK to go over because of some unforeseen trouble, but to look into the eye and say:"It will be finished tomorrow" and then start coding next week is not acceptable.


The problem isn't that programmers can't keep deadlines, it's that they can't make schedules. He never should have said it would be done tomorrow, he should have said "Two weeks". - Bill K
Unfortunately i tend to be one of those 60% of the time. I have a whole lot of books on time management. I hope i'll make it someday. :p - redben
The bigger problem is managers who promise deadlines without consulting the developers in question first. - FerretallicA
31
[+3] [2009-01-10 21:28:39] John Boker

I've found that a lot of programmers don't know about the for loop. They'd rather use:

Dim i as Integer = 0
Do Until i > 10
    'do stuff
    i = i + 1
Loop

And when I tried to let one know about the for loop he got mad and said he wasn't going to rewrite all his code just to use a different kind of loop.


Haha lol! You serious? - Jonathan C Dickinson
(4) maybe im using the term "programmer" loosely. :) - John Boker
32
[+3] [2009-01-28 04:07:50] kal

Always starts by writing concrete classes instead of starting to "program by interface".


I've seen a few variations of this. A good one was never create an abstract class that you will have less than three concrete subclasses. Another follows the same template, Code must be reused at least three times before it can be called generically reusable. - TokenMacGuy
33
[+3] [2009-01-28 06:23:04] CAD bloke

Cowboys who just want to write code before they have finished understanding and then debugging their business rules & requirements. Once you have finished slashing your business requirements and rules with Occam's' Razor [1] the code, modules, libraries, data structure etc. that you need will be bleedingly obvious.

Horse first, then cart.

[1] http://en.wikipedia.org/wiki/Occam%27s_Razor

Try it when this is type of development practice is actually policy. - David
Yeah, but a dose of this isn't always so bad. The flip side is ... teetotalers? who get stuck in "analysis paralysis" and never write a lick of code. - harpo
Too true. There's always this notion that client has a really good idea of what they don't want, and will tell you when they see it but haven't a clear understanding of what they do need. Sometimes you need to make something that is broken so they can refine their needs. - CAD bloke
34
[+3] [2009-01-27 20:16:19] MSN

The difference between "I need to get this done" and "I need to get this done here" (as in I need to add code in this specific location). By far the biggest issue I have encountered in scaling systems up is where code written by various people puts a lot of logic that should live in separate levels of abstraction in a single place.


35
[+3] [2009-01-14 03:07:08] user45226

My favorite one is that linked lists are quicker for adding and removing items in the middle than array lists. So many people fail to grasp the subtler concept and give the canned answer that everyone seems to propagate. This is in Java in particular, but the pet peeve applies to the concept in general. Say you have list.remove(2000) in a list of 4000 items, they claim it will be quicker in a linked list than in an array list. What they forget about is how long it will take the above call to find the 2000th item ( O(n) ) and then remove it ( O(1) ). The iteration will be done in Java code many times over. With an array list, it will be a low-level memory copy which, while is o(n) as well, will be quicker in most cases than iterating a linked list.


(1) Well, what about removing every other element between the 1000th and 3000th element? A linked list can be modified in O(1) as many times as required while you iterate over it. - Michael Borgwardt
(1) the basic peeve stands. In some cases a linked list is faster than an array. In other cases the array is faster. It takes a full understanding of what an algorithm is doing to make a statement about its run-time complexity. - TokenMacGuy
@TokenMacGuy: That tells me the basic peeve is about people making vague claims (or someone has misunderstood what is claimed). If you have a position within a linked list (e.g. a pointer in C or an iterator in C++) rather than a mere index, then there is no O(n) lookup. Perhaps it's really a pet peeve about insufficient linked list implementations/uses, since it's rarely a good idea to use only indexes with them? - Fred Nurk
36
[+3] [2009-01-08 11:10:09] Shane MacLaughlin

With large datasets being moved between systems in XML, not understanding the merits of SAX over DOM, and the performance implications of selecting DOM simply because it is easier to implement. I have seen a number totally unnecesary performance bottlenecks and system failures over this, with XML getting blamed rather than the lazy parser implementation.


I think you mean non-lazy parser implementation, when you should use is not unlike a lazy parser... - SamB
37
[+3] [2009-01-08 15:04:00] David Thornley

Code is not just for communicating with the computer, but also with fellow programmers.

You can throw all sorts of rules on comments and variable names at people, but it really doesn't matter that much. Either they grok the above (and don't need rules except perhaps as guidelines) or they don't (and will only obey the letter of the rules).


Optimistic, are we? [re: "grok the above"] - SamB
@SamB: You bet. - David Thornley
38
[+3] [2009-01-08 14:11:35] Carlos Eduardo Olivieri

Just one of the most symbolic examples of ignorance in programming (C#):

    private string GetMonth(int Number)
    {
        switch (Number)
        {
            case 1: return "January";
            case 2: return "February";
            //And so on...
            default: return "Invalid";
        }
    }

wouldn't your compiler give you an error if you tried to return a string when it expected an int? I'm pretty sure this wouldn't actually compile - Brock Woolf
@Brock, this would compile. Although I see his point! Resource files (not in this case) and ToString() (which will piggy-back off of Windows Resources) are the best way forward. - Jonathan C Dickinson
I see a couple of issues here. One is "Number" should be lowercase per common naming conventions. Also, it should use a Dictionary<int, string> instead of a big switch block. - James M.
(1) Er, this has GOT to be in the library! - SamB
I would never do it, but behind the veil of ignorance is a tiny gem of hope: this ought to be compiled into a jump table, and in that respect it isn't so different from an anonymous array of strings. - Jon Purdy
(1) Of course, there is a library method, culture-dependant CultureInfo.CurrentCulture.DateTimeFormat.GetMonth(monthNumber) - dbkk
39
[+3] [2009-01-08 13:31:19] Juliet

.NET != C++

Saw this yesterday: a programmer wrote some code in VB.NET which passed all parameters ByRef between a few dozen functions. I asked him why he wrote it in that style, and he commented that .NET would make a complete copy of every array parameter before it passed it to another function. I correct him, "yes, it'll make a copy... of the pointer, but not the entire array".

He fought with me on that fact for a few minutes. I decided it wasn't worth my time to "fix" code that wasn't broken, so I left it as is.


That sounds like validation of stackoverflow.com/questions/423823/… - Jon Skeet
I like this one. :) - LarryF
Uh.. The answer, not the code style mentioned... heh.. - LarryF
40
[+3] [2009-01-08 19:54:35] Demian Garcia

The myth that writing the code is the main part, while debuggin is just an extra.

They are both faces of the same coin. If one is shitty, the overall result will suck.


41
[+3] [2009-01-08 18:35:04] MSN

The power of Google. Or Find in Files.


Who needs to ctrl-F to find something when you could just take endless amounts of time looking through it on your own? :-P - Evan Fosmark
(1) I meant as opposed to asking me :) MSN - MSN
tinyurl.com/67ewkc - Kevin Panko
42
[+3] [2010-01-10 14:23:40] EvilTeach

This is really anal, but I abhor the use of NULL to describe the character that is used to mark the end of a string in c.

NULL is associated with pointers.

NUL is the name of the ASCII character that represents '\0'


In C, the term "null character" is used to refer to '\0'. The ASCII character may be called NUL, but in C the terminator is called the null character. - James McNellis
43
[+3] [2010-01-18 12:56:08] Chris

My pet peeve is programmers who don't try to understanding something, they have the attitude that the "compiler" will figure it out for them.


44
[+3] [2010-01-02 20:34:16] cartoonfox

"It doesn't matter that Java doesn't have feature X - because with a little bit of coding around (in all the places where X would be used) achieves the same effect"

Where X can be:

  • closures
  • continuations
  • an OO metamodel
  • anything else

It's another way of saying "I get paid to do Java and it's a general purpose programming language so I don't need to bother to learn anything else"


(1) Yeah. The paper "On the Expressive Power of Programming Languages" citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.51.4656 deals with the common fallacy that since most languages are Turing complete, it doesn't really matter that much which you use. - SamB
45
[+3] [2010-03-21 05:23:38] MPelletier

Some prefixing of variables is just aggravating:

  • temp- In the end, all variables are temporary
  • scr- (for scratch, meaning temp)
  • my- (OK in example code, but not in implementation)

(1) Add on there <short_product_name> for instance, if your product is ABC Accounting, having all sorts of variables like abcWindow and abcSqlConnection - Earlz
(2) I can see your point about "my", but I think "temp" communicates something helpful: such variables are typically much shorter-lived than others. E.g. a variable used for swapping two values. It gives a hint that the variable does not directly affect anything beyond the immediate context. Taking "all variables are temporary" to its logical conclusion, all hardware, people, and stars are also temporary. Yet the differing degrees of longevity matter. - LarsH
@LarsH: very good point. "Temporality" is indeed the key. For such operations as swapping, I'll name/prefix it temp myself. But when you see that "temp" live on for the remainder of the function (sometimes a very long one), it gets irksome. Working with array based language J, I can tell you that very often you take a matrix and transform it a few times. If you want to lay down your code and not just have a string of ascii characters, you'll create several steps, each of which is temporary, but there temp- just denotes lazy naming. - MPelletier
46
[+3] [2010-03-08 01:29:38] Joe Carnahan

The belief that the ease of writing code in a language is a more important quality of the language than the ease of reading code in that language.


47
[+3] [2010-03-12 12:46:32] Bruce McGee

Using ".Net is the future" as the primary justification for rewriting existing working software. The same developer once described it as "God's will".


48
[+3] [2010-03-13 18:29:19] luckyluke

I read 4 pages of that and I really need to post... (hope no reposts;))

I hate when developers forget that they write soft to BE usable by people who are not programmers, and not taking into account that for a non-programmer smth may be difficult to grasp..

Also 'index base programming' - a fantastic paradigm I have kept on rediscovering in many lines of code eg.

List<int> linesChecked
List<Rectangle> drawnRectangles
List<whatever> something

and then orchestrating all the lists using one index because the things are ESSENTIALLY a single object. duh

A third.... not leaving the default: in switch statement... it's there because something CAN really happen, one can recompile the enum, whatever.... duh (an infinite source of bugs for me:)


(1) Yeah, what is this, BASIC? Come on people, use records! - SamB
+1 Good point about the possibility of an enum being redefined. - user359996
49
[+3] [2009-08-14 12:08:22] Jesper

Changing code, but not updating comments

I come across code sometimes that has evolved over time, but the people who worked on it didn't update the comments around the code - so that the comments refer to what was there before, and not the current code.

Misleading comments in the code are worse than no comments at all.


50
[+3] [2009-11-15 03:55:45] Max Strini

Not just programmers (though they are unfortunately very much represented in this group), but I'm annoyed by people who don't understand or appreciate the role of research in driving progress in technology (I say this as an industrial programmer, not a researcher, btw) and don't understand how long it takes for something to go from an idea to mainstream reality, or how long a history each "new hot technology" really has.


51
[+3] [2009-12-23 22:33:57] FeatureCreep

The My-app-should-run-in-full-screen-by-default-even-if-you-have-a-30-inch-monitor-attitude.


I'm fairly certain that it's not the inches that matter, but the degrees -- that is, the portion of your field of view occupied by the screen. - SamB
52
[+3] [2009-06-12 17:48:45] Zan Lynx

My peeve is programmers that don't consider the memory footprint of their software. They develop code using STL or other data structures and they automatically pick a set or map instead of a vector or deque.

Gnome software does this a lot. One of the data structures provided is a GTree that uses GNodes that have five pointers each! Some people use this to store data items smaller than the nodes!

Now imagine what this does when built with 64-bit pointers.


Well, it means a 40 byte overhead per node - that's 4MB for 100,000 nodes, or less than 1% of the total phyisical memory (otherwise, why would you have 64 bit pointers?). Worrying about that is purely premature optimization. - Michael Borgwardt
It is the difference between 1 MB notification bar programs and 5-10 MB programs. - Zan Lynx
(1) Also, I used to run 64-bit Linux on a 1GB system because I wanted to use the larger/more registers of the Athlon-64. - Zan Lynx
(1) +1 - Avoiding premature optimization just means waiting until you know how to prioritize optimizations, but too many people use the mantra as an excuse to ignore resource usage/waste altogether. And @Michael Borgwardt, it's a bad idea to make assumptions about "total physical memory" unless your app will own the box. Other poorly-written software might have already eaten up the other 15.999 GB. - James M.
(1) @Michael - The cache in the processor is measured in megabytes. Memory bandwidth is the new bottleneck. - Tom Leys
53
[+3] [2009-06-12 20:42:51] sean riley

When programmers confuse classes and instances when talking about systems. The word object often gets used ambiguously to refer to classes and instances in both casual and formal conversations about architecture and software engineering.


54
[+3] [2009-08-28 23:19:16] yelinna
somefunction(){

try { .... put your whole code here .... }

catch{}; // empty catchy!!

}

55
[+3] [2009-06-29 20:36:29] Bastien Léonard

Claiming that things like if/else vs. switch will obviously improve the performance of a program.

Because it's premature optimization, but also because people making such claims don't know what they're talking about, and yet they feel the need to teach other people how everything works.

Other examples:

  • Thinking that you just have to add some mutual exclusion, and voilà you now have a faster program on multiprocessor machine. It's especially funny if the person telling you that synchronizes threads with busy waiting, and is proud of it.
  • Thinking that a garbage collector necessarily slows down a program.

56
[+2] [2009-05-29 17:04:37] crauscher

Revert 'small' refactoring because running the unit tests before committing takes too long.


57
[+2] [2009-09-17 20:15:23] SLaks

Developers who don't understand .NET naming conventions.

Examples (from a real library that I had to use):

public delegate void FooBarVoidVoidDelegate();  //FooBar is the component name.

public enum FieldTypeEnum {
    OBJECT_NAME,
    FIELD_SIZE
}

public delegate void ConnectedDelegate(object sender_, ConnectedEventArgs args_);

The temptation really is great, at first, to name delegates with the "Delegate" suffix. As if it was a totally different entity altogether that deserved its own naming convention. I do declare guilty on that one. - MPelletier
I must admit I don't understand this. (Probably related to not having a clue what delegate means, and that I have done very little with .NET...) - SamB
58
[+2] [2009-05-01 21:35:08] Marco van de Voort

The remark "reinvent the wheel". Look around you, do you see one size of the wheel fitting all?


(5) There's nothing wrong, necessarily with reinventing the wheel. The question is, is that really what you're up to? If you are serious about researching the technology of wheels, and get a good feel of what makes a good wheel and a bad one, then there's nothing wrong with expending engineering effort at improving or rethinking it. On the other hand, if you want a cabinet that rolls, spend your energy on the cabinet, and use an off-the-shelf wheel. - TokenMacGuy
The problem is when round wheels of appropriate type are available already, and people go around inventing square ones... - SamB
So maybe then the mantra is correct. It is the difference between inventing (wheel is round) and making a specific one. That is hairsplitting though. The point was that the mantra is used wildly inappopriately. The complexity of buying stuff and services (and worse, characterizing it that it furfills the destiny) is very underrated - Marco van de Voort
59
[+2] [2009-03-29 03:53:16] ewakened

In a dynamic language, not using Duck Typing and littering the code with tonnes of switch statements!


This pattern is excellent, and should be the way forward, but it still seems kind of like a new-ish concept (the term at least), so I tend to forgive this, so long as the solution isn't too awkard, such as using multiple inheritance or interfaces or adaptor classes or some such in a polite way. Endless switch statements aren't elegant in any case, and annoy me plenty. - TokenMacGuy
60
[+2] [2009-12-14 16:52:31] viky

They just develop skill in one language and try to do everything with the same, they don't try to understand that there are scenarios when C++ should be preferred over C#. They don't think to go out of the Box.


(1) Hmm. I'm honestly not sure when C++ should be preferred. (I tend towards C for low-level code, myself...) - SamB
61
[+2] [2009-12-15 14:37:47] PA

I find myself particularly irritated when a I encounter programmers who act as if documenting bugs is enough to get along instead of fixing them. Those people who even argue against those who discover bugs in their codes. Even defending defective implementation with a "working as designed" attitude.

I hate the "known problems" sections in readme files.


(3) At least they are admitting the problem exists. Be very glad you have not had to work in a ship with developer(s) who refuse to admit bugs exist, even when presented with clear demonstrations of programs freezing, locking up, or just not doing what they are supposed to. - David
(1) Sometimes we do this because they have not figured out how to actually solve the problem, but wish to remember the existance of it so that we can figure it out later (in addition to warning users in the meantime)... - SamB
(1) Fixing non-trivial bugs always opens up possibilities for regression (creating new, unknown issues), and requires more testing. Some bugs are better left documented and unfixed if shipping in a timely fashion is a consideration. - dbkk
62
[+2] [2010-02-27 00:58:04] Hank

There are a lot of good answers here already. Here are my top four:

Continuous Learning: It's one of my most important interview areas. If you aren't learning anymore, you shouldn't be in this business.

Arrogance: I have no patience for a developer that say something should be done that way "because it's the only way".

Over-commenting: If your code is written so that it can be maintained by others, it doesn't need comments describing each line.

Consuming Errors: Putting a try/catch around each section or just returning from each function when an error condition occurs isn't HANDLING an error. It takes a lot more time to track down a bug if an error condition is consumed.


63
[+2] [2010-04-19 02:57:04] Zombies

Programmers who decide to deviate from a standard just to make it work. This lack of concern also means they won't share this information until after they have commited their several revisions.


64
[+2] [2010-04-17 03:56:38] hasen j

Indifference towards retarded compilation/build/project-organization methods that create unbelievable amount of mundane work.

I kid you not, I've seen a dev environment where checking out the latest revision requires 10 (gui) steps, and so does building. Running the full test suite might well require 100+ (gui) steps.


65
[+2] [2010-03-26 16:02:41] emalamisura
  • BY FAR my biggest annoyance is: Leaving Code Commented out everywhere!

  • Not improving code that was fixed, just leaving it alone

  • Not using the framework, for instance, writing their own code to log something instead of using the common logging framework the rest of the team uses.
  • Printing to the Console, and not removing it..cluttering it up for other developers...

66
[+2] [2009-01-08 21:12:20] Breton

Most programmers don't seem to realize that any database product based around SQL is not a relational database. Somehow the whole concept of a relational database gets smeared because of how awful SQL is. Web developers now want to use new untested database paradigms because they just can't stand the idea of using a "relational" (that is, an SQL-based) database. Go ahead and read the SQL standard and try and find any occurance of the word "Relation" or "Relational"

In reality, there has never been a mainstream relational database. There's a couple research programs (like rel) that implement the relational concepts. But it's all got this kind of grampa's suspenders air about it, that nobody wants to touch, because it's just not hip to be mathematically and logically rigorous nowadays.


(1) This doesn't make any sense. SQL certainly is "relational". - JosephStyons
Then don't you get it? isn't this raising any alarms? You're an ignorant programmer! You can start at the wikipedia entry for "Relational Model" and then read any of the books of Chris Date. Quickly! - Breton
+1 because it is HUGELY Controversial, and according to the classic definition of the Relational Model, he has a point. - Binary Worrier
Controversial? Maybe. I have noticed there's a lot of fuss and bother about it. Only one side seems to have any rational and compelling arguments though. The otherside only seems to have "because", and occasionally "Performance", though that second one never has any figures to back it up. - Breton
I don't think that web developers have a problem with SQL databases because they are offended by the lack of relational purity in commercial RDBMS's -- I think they are just not interested in any kind of database at all. - David Aldridge
You don't miss what you don't know anything about. "Ignorance is bliss", as they say. - Breton
@David: I think they just want magic. - SamB
67
[+2] [2009-01-27 18:48:43] Johannes Schaub - litb

In C++:

Myth: std::getline is a global function.

Reality: std::getline is not a global function, but a function defined in the namespace std.

There is a common believing that things that are defined in namespaces other than the global namespace are all global. But in fact, that can cause confusion as to not knowing where stuff is really defined.

Here is an example where to avoid confusion: Instead of saying such things as

1) global int variables are initialized to zero if an initializer is omitted.

Say the following, which is more correct and probably is what you really want to say

1) namespace scope int variables are initialized to zero if an initializer is omitted.

Note that just because there is no "namespace... { ... }" around the global scope doesn't mean that there isn't a global namespace: This namespace is not user defined. It's implicitly created by the compiler before anything else happens.


If you pass a std::cin as the first argument, then Koenig lookup means getline "looks" global because you don't need to qualify the std:: on it. i.e. "std::string line; getline(std::cin, line)" will compile. - richq
rq, right it looks like it's a global function. but it isn't :) but actually that was just an example. i could have used any other function that's within some namespace and is not global to make my point - Johannes Schaub - litb
rq, in addition the fact that you can call a function without telling its scope does tell nothing about whether it's a global or not. consider struct s { void g() { } void f() { g(); /* g is a global??? */ } }; - Johannes Schaub - litb
It just says that the thing "is in scope". It doesn't say from which scope it comes :) - Johannes Schaub - litb
(2) Huh. I'd call that stuff global ... it's still reachable from anywhere! - SamB
@SamB, it's not reachable from outside std. Try int main() { cout << "a"; } and you get an error. You need to qualify it with std:: or use a using-declaration/directive. That's what makes it very different from global names. - Johannes Schaub - litb
(1) Johannes: the way I see it, that's just a long global name which it is possible to abbreviate under certain circumstances... - SamB
Global, as used in conversation by programmers, does not have a single rigorous technical definition. Singletons encapsulate global data or global state, for example. That's how English works: if you want to specify the global namespace exactly, then you can just say "the global namespace" ("root namespace" also sometimes heard). The pedantic treatment of "global" above does not seem productive. - Fred Nurk
@Fred cplusplus.com uses it on their website to decorate functions like std::getline as "GLOBAL". That's not in my opinion a situation where programmers are in a conversation. They have enough time to find accurate wording to write their stuff. Also, where C++ has own definitions, its definitions shall be used instead of the usual english ones. - Johannes Schaub - litb
@Johannes: Oh, that site. Of my many pet peeves with it, this is really minor. :) - Fred Nurk
68
[+2] [2009-03-05 09:24:06] Vordreller

My Pet Peeve?

Undocumented code. All the rest can be solved or worked around.


Except for incorrectly documented code. - David
69
[+2] [2009-03-07 22:28:49] AviD

Most of my "favorites" are already up here, but here's one I just ran into again last week (from an otherwise decent programmer):
Traversing the ENTIRE XML DOM tree, when searching for a specific node (or nodes), using methods such as Children[], NextSibling(), etc.... instead of a simple call to SelectSingleNode (or SelectNodes) with a simple XPath expression. This of course resulted in many recursive calls, not to mention HORRENDOUS performance...

Of course, this can be generalize as "not using code the way it is meant to be used".


70
[+2] [2009-03-17 16:19:22] PaulG

Unreadable code. And large, flat LabVIEW block diagrams that take a couple thousand pixels in both directions. And bland and ugly UI's. And noisy workplaces. And knowledge silos. (What? we can only have one?)


You can have as man as you like, but you are advised to use a separate answer post for each discrete response. - TokenMacGuy
+1 for noisy workplaces. - Ant
71
[+2] [2009-01-11 02:33:36] Paul Morrison

My pet peeve is a sort of brain-washing that most programmers don't even realize has happened to them - namely that the von Neumann machine is the only paradigm that is available when developing applications. The first data processing applications using machinery were what was called "unit record", and involved data (punched cards) flowing between processing stations, and the early computers were just another type of station in such networks. However, as time went on, computers became more powerful. Also the von Neumann architecture had so many successes, both practical and theoretical, that people came to believe this was the way computers had to be! However, complex applications are extremely difficult to get right, especially in the area of asynchronous processing - which is exactly what the von Neumann machine has trouble with! On the other hand, since supposedly computers can do anything, if people are having trouble getting them to work, it has to be the fault of the programmers, not the paradigm... Now, we can see the von Neumann paradigm starting to run out of steam, and programmers are going to have to be deprogrammed, and "go back to the future" - to what is both an earlier, and a more powerful, paradigm - namely that of data chunks flowing between multiple cores, multiple computers, multiple networks, world-wide, and 24/7. Paradoxically, based on our experience with FBP and similar technologies, we are finding that such systems both perform better, and are easier to develop and maintain.


(2) -1 for a poorly formatted answer. Ever heard of paragraphs or bulleted lists? // And while we're on the subject, I sincerely hope that you pack a fair amount of whitespace into your code; because if it's anything like this post, it would surely be difficult to read! - Jim G.
72
[+1] [2010-04-19 02:55:03] Zombies

Programmers writing "helper" code (eg: buggy date validation that doesn't use regex to parse and breaks on certain dates since they were unable to understand testing works by not merely running it once on their machine) that can easily be found in the default language API or some commonly used library such as Apache Commons.


(1) I'm unsure how using regex would be an improvement... - SamB
Why wouldn't you understand that a regex can parse a valid date format? As opposed to writing date.length == 10, date.countChars('/') == 2? - Zombies
(3) @Zombies What's a valid date format? Me, I see dates like 12 มิ.ย. 2552 quite often... - dbkk
73
[+1] [2010-03-22 03:16:22] JohnFx

This could would be so much better if I could just re-build it from the ground up.

No, it wouldn't [1].

[1] http://www.joelonsoftware.com/articles/fog0000000069.html

(3) I disagree, many times from the ground up is better. But it depends on scope and risk of changing the existing software. - Chris Marisic
74
[+1] [2010-05-12 16:57:51] Vinothbabu

Datastructures..... people don't know what it is first... but go on with programming.


75
[+1] [2010-05-12 17:06:26] Hooray Im Helping

Thinking that their code is the reason the business exists, not the other way around.


(1) Except with many businesses they wouldn't exist without our code! - Chris Marisic
Actually, in many situations businesses rise and fall at the mercy of a code base. - M2tM
76
[+1] [2009-12-31 18:23:30] Jay

The belief "What I think is good is always best"

I've worked with many programmers who believe they know what's best for everyone because it's what's best for them. The "best" code is the best solution to the code user's problem. It may not be the most elegant, fastest, easiest to maintain, coolest, easiest to read, best documented, most advanced, newest technology, etc.

Unfortunately too many employers don't spell out their requirements for good decision making so I can't really complain too much.


Why are "coolest", "most advanced" and "newest technology" on this list? - user359996
They're subjective or irrelevant measures of code quality. Which is the heart of my "peeve". - Jay
I misread what you wrote. Thanks for clarifying anyway. - user359996
77
[+1] [2009-09-23 19:49:13] Tom

Incomplete/inaccurate/missing documentation

I know this was partially answered before, but mine has two parts:

  1. When I inherit code from another programmer, I'd like to see what the intent was behind the code. When I started my current job, I inherited a number of classes that were heavily dependent upon a knowledge of specialized business math. In order to make corrections, I had to spend a lot of time with senior management learning what the math was supposed to be, why, and how it would look on paper (immediately got documented). With proper documentation, my time spent would have been cut by 75%.

  2. Component documentation. My company spent hundreds of dollars for your company's components a few months ago as they have the most functionality that we can use. Now you have a new release, and the documentation is incomplete and inaccurate because you did an overhaul on your methods and properties. Now I have to spend multiple hours figuring out what's wrong with my code because of your changes. Now I have to hunt through source code and keep playing with different switches because it no longer works properly. Please, is it too hard to document not just the change log, but also the help files? I know it's not. All you have to do is show sales a noose and ask them to back off their artificial deadline before the deadline gets used on them (not really, ignore last part).

As a part of number 2, why don't component developers ever document custom exceptions their code can throw? Why do I have to waste more hours testing every case to find out what exceptions can get thrown? Because I don't have the time to find every obscure exception buried 6 or 7 layers deep in the component code that might hit me, I'm forced to generic handling (and yes, this is based on my reality, no exaggeration or whining intended).


rolled back as didn't see the need for a period after a sentence fragment according to grammar rules. - Tom
78
[+1] [2009-06-19 02:38:01] indyK1ng

For me the worst thing someone who wants to be a programmer can ignore is the need of commenting. Everything else doesn't matter so much, as in a normal workplace somebody else can fix the error. While those issues may be time consuming, not commenting can make any of the necessary fixes or changes take much longer than necessary since any developer would have to figure out what the code does before they can make any changes. Some would say that this isn't an issue if the same developer who wrote it is making the changes, but even then people won't recognize what the code does. This is why commenting is so important. Sadly, I know of a graduate director who has only ever written one comment in 147,000 lines of code and most of it doesn't work the way it should.


79
[+1] [2009-06-19 02:49:21] FogleBird

Emulating sets with dictionaries, or failing to see when a set would be appropriate.

Setting the value in a dictionary to some random value instead of just using a set data structure.

d[key] = 1 # now `key` is in the set!!

Or general ignorance of set data structures, using lists/arrays instead.

Sets offer O(1) lookup and awesome operations like union, intersection, difference. Sets are applied less often than they are applicable.


(1) I still don't get why .net lacks a Set class in the BCL... I use them almost as much as true maps//dictionaries. - Robert Fraser
@Robert: System.Collections.Generic.HashSet - Dour High Arch
@Dour Only in .Net 3.5 and later, which is fairly recent. - dbkk
80
[0] [2009-06-20 06:33:55] community_owned

Version control.


81
[0] [2009-07-10 15:18:21] Henning
  • comment your code

  • write unit tests

  • be userfriendly


Huh? Those are peeves of yours? - SamB
I think the question is misleading and was a bit different when I answered. I name the important subjects being ignored too often by developers - and this fact then, in turn becomes a peeve! - Henning
82
[0] [2009-07-29 02:24:57] Matt

Not putting the extra effort to be clean when committing code... Nothing annoys me more than people who commit print statements, extra spaces or end-of-line characters as a result of their debugging.


I do that.... allllll the time :) - Earlz
83
[0] [2010-03-21 02:38:22] MPelletier

Test by try/catch

This must be bad for my heart.

Example is in J. Suppose two vectors. The dyad ,. means stitch, a.k.a. align these two vectors side-by-side in a matrix. Now suppose that for some reason, you have vectorA and vectorB, and you know that vectorB can be one off. I've seen this in a function trying to alter colours between two rows, vectorA has the odd rows, vectorB the even rows, so either vectorB will be the same length or one off.

    try.
        vectorA ,. vectorB
    catch.
        vectorA ,. (vectorB, a:) NB. append an empty item
    end.

This is considered normal in some languages, notably Python, where it's called "ask forgiveness rather than permission", and more often than not has a notable negative impact on speed. My least favorite use is list.index raising an exception if it can't find the object, rather than returning None. - Joe Wreschnig
I would not consider the above valid in J. There is a totally acceptable way to test for this. And since J cannot catch by exception type (I think. although one could fetch the exception type and perform a switch in the catch), my example could occur on a length error or a domain error, where types aren't compatible, or a syntax error, if a variable isn't declared). Plus, ,. is a bit of a resource monster. Using it, watching it fail, then using it again? That's a crime! - MPelletier
84
[0] [2010-04-19 01:54:31] marharepa

My pet peeve is my ISP. Especially when the support says: "Turn off your modem, wait 15 seconds and turn in again. Is it okay now?"


Yeah. It's a pain when technical support is not actually technical ... - SamB
(4) In atleast 50% of the cases where my modem isn't working, this solves the problem. As long as they know what to suggest after you tell them that didn't work, I see no problem with this. - Wallacoloo
I called them because my server's IPv6 settings... - marharepa
(1) I usually try restarting my modem and such things before I ever call :P - Earlz
(4) Rules for trouble shooting most network stuff: 1. Locate the most complex least expensive hunk of consumer electronics in the system (like a cable modem). 2. Disconnect power from the device (power switches and reset buttons cannot be trusted, unplug it). 3. Wait 30+ seconds (modern capacitors are very efficient and electronics designers love to scatter them all over). 4. Reconnect power. WAIT at least 2 minutes. 5. Test. If this does not work: Find the least complex MOST expensive hunk of electronics (like a Cisco Ethernet switch) and perform steps 2-5. :) - Rusty
You're forgetting that 99.99% of the population is not a programmer, and a good part of them will NOT reboot before asking for help. Some of them probably also did not notice that little switch labeled "power" that is turned off. - nico
@nico: unless, of course, they're still on 9x, in which case they're nearly always aware that it might help... - SamB
85
[0] [2011-01-03 20:47:11] Jay D

I have observed that most of the so called programmers who come from the service industry are more oriented towards just providing something that does what requirements say. They don't care:

1 whether and how (time and space complexity ) optimal their code is,

2 are there ways to improve it if yes what are those. ?

  1. I understand that there are deadlines for a given project so one can do a optimistic job to finish the task but still there are product life cycles. They are careless about speeding it up in next product life cycle.

  2. And the worst programmers give excuses such as about documentation and communication delays (across continents ). And it pisses me off. :-|


86
[0] [2009-01-08 13:31:22] Carlos Eduardo Olivieri

So many things are very common. For Example, "Do you know programming in assembler?"

  • Confusion between class and object.
  • Doubt about when use heap instead stack.
  • Problems with Scope.
  • To declare boolean variables and after do something this : if (x > 1) a = true else a = false.
  • Briliant phrases like "The language is not much important."

And so on.


87
[0] [2009-01-08 13:33:10] Think Before Coding

That skilled programmers have a better value on business code than on technical code.

Affect your better coders to implement your domain model, they'll make it better, and that's the most important point.


88
[-1] [2009-01-08 10:43:29] arul

Ignorance of the fact that questions like this should be community wiki.


(5) Rolled back. If you don't like the answer, vote it down, don't just remove it. - Dan Dyer
89
[-1] [2010-04-20 19:40:21] MSN

Programmers are people and as such are expected to function as a socially responsible member of society or company.


are you saying we are not people ? :) - David Brunelle
It's a direct answer to "things that everyone who aspires to be a professional should know and take seriously, but doesn't?" :) It's confusing, I admit. - MSN
90
[-1] [2010-03-21 04:57:31] Joe Wreschnig
bool finished = false;
for (i = 0; i < size; i++) {
    if (something(i))
        finished = true;
    ...
    if (finished) break;
}

Rather than

bool finished = false;
for (i = 0; i < size && !finished; i++) {
    if (something(i))
        finished = true;
    ...
}

Languages support a full conditional in loop clauses for a reason.


(2) True to a point.... you may want to exit BEFORE the end of the loop. In that case the second solution won't work. - nico
(3) what about for (i = 0; i < size; i++) { ... if (something(i)) break; } - Johann Philipp Strathausen
Wow, -1? I'm glad to see unstructured programming is alive and well! - Joe Wreschnig
91
[-2] [2009-01-08 13:31:50] Jonathan C Dickinson

For Pete's sakes please don't use ALLCAPS for any form of constant in C#. Be it enums or const or ANYTHING. If your IDE doesn't tell if something is a const, you should find a new IDE, or failing that a new hobby/workplace/job.


What if your workplace has standards that force this? :) - Kevin Tighe
The same is true for C++ - the all caps notation is to warn you that you're doing a (potentially dangerous) macro expansion. using it for const objects makes macros stand out less. - Ferruccio
Why was this downvoted? Weird … shouldn't really be controversial, if only because of the saying “when in Rome …”: It's simply not C# style. - Konrad Rudolph
(1) If your workspace enforces this you work for lunatics :). Reason it was downvoted? Probably because StackOverflow throws out a big net: they are bound to get a few boots. - Jonathan C Dickinson
Wow, I thought the all caps thing was pretty much universal. Go figure. I guess that's Java hubris :) - fluffels
(10) I still use ALL_CAPS for constants and find it a useful readability aid. You shouldn't have to rely on tooltips in your IDE of choice imo. - Dave R.
@Dave, as long as you are not writing a public API I guess it is fine. In all other instances conform, conform, conform (you don't find ALL_CAPS in the .Net framework). - Jonathan C Dickinson
I kinda like it, but I guess to each his own. I really dislike this.classVariable when it's not necessary for the exact reason you posted (the editor should tell you), so I'm not going to completely disagree, but I'm still using caps for constants. - Bill K
Visual Studio doesn't tell me something is a const - that's why i ALL_CAP them. - Ian Boyd
@Ian - it does. Look at the intellisense icon for the field. - Jonathan C Dickinson
I could not agree more. - SLaks
92
[-7] [2009-01-12 10:53:57] community_owned

Pretentious questions like this :-)


93
[-8] [2010-06-14 09:33:04] stormianrootsolver

Using Java.

You can't imagine how much I hate software written in Java. Clumsy looking GUIs with tons of display bugs, the resource hogging "java automatic updater"...

Second worst pet peeve:

Using anything else than C# / F#. There is no justification, except in extreme cases (OS development or when you need to talk to the CPU directly to use SIMD). And then - only write as little as possible in unmanaged horrorlanguages from hell (C++, etc... choke) or, even worse, "dynamically typed languages" which are nothing but toys for masochists who hate understanding code and helpful tools like Intellisense.

Third worst pet peeve:

Unneccessary P/Invoke...


(1) That's Java on the Desktop to be precise, and is more of an issue with Swing (the GUI toolkit). Nothing wrong with Java programming language itself (e.g. when used on a web server, or for Android apps). - dbkk
+1 for Using anything else than C# / F#. There is no justification, except in extreme cases (OS development or when you need to talk to the CPU directly to use SIMD).: Looks like you and I would get along. - Jim G.
+1 for dynamically typed languages. I've developed web applications in PHP and I know what I'm talking about when I agree with your statement ... Swing does indeed look clumsy and ugly, that's right. - Marius Schulz
(3) I think you're confusing poor use with poor technology - there are some Java Desktop apps with absolutely brilliant user interfaces, so good that you'd never know they weren't totally native unless you went looking. Similarly with dynamic languages, there's been a lot of developers using the lack of static typing as an excuse to be cowboys. Good dynamic language code requires greater discipline, not less. - Bevan
I also hate Java, but there is one justification for using it - the JVM is much better than the CLR. That's why I have high hopes for Scala. - Craig P. Motlin
(4) Are there any solid arguments for this? Without them this post looks to me like a typical case of evangelism. I do also like C#. ... and Java and Python and PHP and Prolog, and ... No matter how you look at it, a developer who dabbles in only one corner is not looking at the Big Picture IMHO. Oh, and I am sure that you can easily write abysmal code (with an eyesore of UI to go with that) in C#. You are actually demonstrating one of my fav. cases of "programmer ignorance". - exhuma
Python is a horrible dynamically typed language, PHP is... well... LOL... Prolog? Seriously? And Java... if I can get the more complete, more high quality .NET - framework and a language WITHOUT the ugly egypt dancer style parentheses, why would I use Java? No, thanks. Microsoft has provided us with the last necessary answer, it is C# / F#. Case closed. - stormianrootsolver
You know javac can compile code with different styles of curly braces, right? Have you tried Scala? - Craig P. Motlin
@exhuma: you could not have said it better - nico
On Java: agree. - FerretallicA
94
[-9] [2009-04-05 01:58:06] Paul Morrison

Users of any application - or device - who call you up and say "It doesn't work".


(6) -1 Programmers who blame the user. - Tom Leys
(3) Well, that's not nearly as bad as emailing you or filing a bug report saying that. If it's on the phone, that's a perfectly valid way to begin a troubleshooting session! - SamB
95