

Things That Annoy Programmers - danielionescu
http://www.kevinwilliampang.com/2008/08/28/top-10-things-that-annoy-programmers/

======
edanm
Funny that #10, 'Comments that explain the “how” but not the “why”', quotes
from an article by Jeff Atwood to show how the comment should have been
written. But in the original article, Jeff actually says that _that_
commenting style is also not as good as refactoring the code:

"That must be what I was getting at, right? Some sort of pleasant, middle-of-
the-road compromise between the two polar extremes of no comments whatsoever
and carefully formatted epic poems every second line of code?

Not exactly. Rather than add a comment, I'd refactor to this:

    
    
      private double SquareRootApproximation(n) {
        r = n / 2;
        while ( abs( r - (n/r) ) > t ) {
          r = 0.5 * ( r + (n/r) );
        }
        return r;
      }
      System.out.println( "r = " + SquareRootApproximation(r) ); "

~~~
dagw
I'd consider that new code a step backwards since it removes the vital words
"Newton-Raphson". If I didn't recognize the algorithm I might have a very hard
time working out exactly how and why that lump of code approximates a square
root. With the words Newton-Raphson included somewhere I could easily look it
up and find out everything I need to know about not only how and why it works
but also its strength and weaknesses. Personally whenever I use some non-
trivial algorithm I haven't made up I tend to include a comment pointing to
the book or paper I got it from so that others can get the canonical
description of what the algorithm does.

Ideally I'd even like to see a brief comment on why Newton-Raphson was chosen
as well. Is there a good reason why I shouldn't replace that code with some
other square root approximation technique or was it chosen because it was the
only algorithm the author knew?

~~~
edanm
I agree that the algorithm name should appear somewhere.

I would probably refactor the code as Jeff says, but add a comment that
describes the function, probably with details about why it's implemented the
way it is.

------
SingAlong
IMHO #11 could be added as "unindented code". I was going to a guy's code
yesterday and I felt very _irritated_ to read it, that i ended up spending
15min indenting it myself. I'm sure a lot of people don't like unindented
code.

and I totally agree with #1, it's very true for me. And especially when I've
used some framework and the framework has been updated to a newer version with
lots of goodies, i feel lazy to maintain code that been written in older
version of the framework. (and even more lazier to update it to the new
framework if it requires lots of changes). I just leave it working fine in
it's current state. Seems like thats what results in legacy software. So I now
follow my new rule-- working on beta versions of frameworks so that i can
leave it unmaintained for longer time and spend the time on new ideas.

~~~
nuclear_eclipse
Do you not have an editor/IDE that can automatically format code for you? Both
Visual Studio and Eclipse can do this, and editors like Vim or Emacs can too.

~~~
mawhidby
I have someone on my team who uses SlickEdit, and it messes up all the
indentations when I look at the same code in Eclipse. I have to spend a few
minutes reformatting it every time he makes changes to the code, and it's a
real pain.

~~~
Ygor
Have you tried ctrl+shift+f in Eclipse?

~~~
mawhidby
Just noticed your reply now. Thanks a lot! That'll save me a lot of time :-)

------
johnl87
When I first started interning at this company, I always wondered why people
were doing stupid things in code and I would fix it to be cleaner and the
program would break. Then I would realize there's a reason it was done in this
stupid roundabout way. People that don't comment their reasons for doing stuff
out of the ordinary annoy me.

------
edw519
A few more of my own:

Being told "how" instead of "what". Use this API to access that database to do
this process. Don't tell me how to do something. Tell me what you want. Let me
figure out how. That's my job.

Being told "what" instead of "why". So you need a 4 GB csv download of the
entire database every day at noon? Why? Oh, in that case, why don't you just
use <somethingElse> which has been right at your fingertips all along. If you
don't understand the system, ask and I'll be glad to help. But don't make up
unnecessary work for me.

Being asked for data to put into your Excel spreadsheet which you will screw
up 8 minutes later. Then you want me to fix it. Forget it. If you have a
business problem, tell me about it. We will find a solution together. Lone
rangers don't get help. I'm not Tonto.

Calling me every 42 minutes for 3 days asking, "Is it done yet?" No, it's not.
I'll let you know when it is and if there's a problem, I'll let you know about
that, too.

Not calling me for 3 weeks after a release. Either it's working perfectly or
no one's using it. It would be nice to know which.

Criticizing my work in a meeting in front of others without talking to me
first. Big mistake. You don't want to piss off your waiter and you don't want
to piss off your programmer.

Meetings when a phone call would have sufficed.

Phone calls when an email would have sufficed.

Status meetings. Pointless. I'll email status. Any questions, click "Reply".

Code walkthroughs that are more concerned with syntax than function.

SQL SELECTs inside of iterations. Please go work at McDonald's.

Sarbanes-Oxley (SOX).

Web filters that screen out Hacker News. Grounds for divorce.

~~~
jacquesm
If you list 'how' instead of 'what' and then continue to list 'what' instead
of 'why', you could save yourself one aggravation in between by being merely
upset at 'how' instead of 'why' ;)

~~~
pchristensen
"how instead of what" - to do something

"what instead of why" - they need something

------
stavrianos
the fact that "width" and "height" aren't the same character length

~~~
Oxryly
Or that "width" ends with a "th" and "height" ends with just the "t".

Just use "sizex" and "sizey" like a Microsoft programmer from the '90s.

------
julio_the_squid
Vague bug reports and scope creep are definitely up there.

One of my least favorite situations is dealing with other people's minor
plugins or libraries...

If it's in Python, usually it's good as-is.

If it's in PHP, usually the structure is so disturbing that if we have to use
it, I simply try not to look. The code ranges from naive to over-engineered,
the latter of which is especially pointless in PHP.

For other people's JavaScript, usually I'm horrified by all of the 'for' and
'if' blocks that are lacking braces. Argh! Half the time I end up rewriting
and removing portions of various plug-ins, and I often feel the compulsion to
go fix all of the lazy bracing at the same time.

------
tomstuart
Top 10 lists.

~~~
Raphael_Amiard
Well top 10 lists are just an organized form of article. It's bad only if the
content is shitty, which it is not, in the present case.

------
jacquesm
How about 'browser incompatibilities' ?

~~~
epochwolf
That's specific to programmers that have to deal with websites :)

You might be able to mak the case that falls under "other programmers" :)

~~~
amalcon
"Operating environment incompatibilities"

------
docgnome
I found number 1 to be slightly inaccurate. I think it would be better as
"What moron wrote this garbage?! That's it! I'm gonna go find out who wrote
this and give th... Oh. That was me. Crap."

------
Pistos2
Previously posted: <http://news.ycombinator.com/item?id=289694>

------
dualboot
Meetings. _stabs self_

~~~
jherdman
Meetings can be exceedingly fruitful when done well. The other day I found
myself chasing a solution for a good hour or so. Realizing the inanity of
this, I called together the interested parties, explained my issue, and
together we worked out a feasible solution and corrected some of my
misunderstandings. Total time commitment of the meeting? Thirty minutes.

The next time you find yourself in a fruitless meeting, consider the things
you could do to ensure future meetings are more valuable in the future, and
work with management to get your ideas in motion. Hopefully you'll improve
your situation, and you'll show initiative that'll look great when your next
review comes up.

------
felideon
\- Justifying why we need to upgrade to the latest OS/tools.

------
msy
I think you meant to submit this to Digg.

~~~
epochwolf
Hacker News is not turning into Digg. Plus, this is relavent and interesting.
:)

------
duck
_7\. Management that doesn’t understand programming_ could be rewritten as 7.
Management

~~~
duck
And here I thought the HN crowd would also be part of the Dilbert crowd. I was
proved incorrectly.

