points by edw519 13 years ago

My default response to any "good programmer, bad programmer" post:

A smart accountant once told me that the answer to "How much money did you make?" is always, "Who wants to know?" If it's an investor, the answer is "A lot." If it's a customer, the answer is "A little." If it's the IRS, the answer is "None."

Same thing here. The answer to "Who is a good programmer?" is always, "Who wants to know?"

To a project manager, the programmer who hits every deadline (regardless of quality) is a good programmer.

To a customer, the programmer who solves their problem quickest is a good programmer.

To a business owner, the programmer who makes them the most money is a good programmer.

To a PHB, the programmer who makes them look the best is a good programmer.

To a journalist, the programmer who tells the best stories is a good programmer.

To a junior programmer, the best mentor is the good programmer.

To another programmer, the programmer they are most likely to want to go into battle with is a good programmer.

To a blogger, the programmer who best fits the profile of the point he is trying to make is a good programmer.

anthonyb 13 years ago

> To a project manager, the programmer who hits every deadline (regardless of quality) is a good programmer.

> To a customer, the programmer who solves their problem quickest is a good programmer.</i>

Up until the codebase is such unbelievably appalling shit that you can no longer add new features, solve problems or reliably hit deadlines. I have worked on too many of these projects to be able to easily count them.

Typically, I'll be the one fixing up something after the previous developer has run away or has been sacked. There's often a culture shock when the manager/customer/project manager who is used to calling the shots suddenly finds that their latest idea needs to take a back seat while deeper (often 'invisible') problems get fixed.

Perhaps another take is that a "good programmer" is one who is still around and still adding features after a couple of years.

  • prostoalex 13 years ago

    In the real world (or at least the world of garage sales and Antiques Roadshow), one man's junk is another man's treasure.

    In the programming world, one man's treasure is inevitably another man's unreadable spaghetti dependency-ridden junk.

    • anthonyb 13 years ago

      Yeah, the code you're working on is really treasure in disguise. Whatever gets you through the day...

      • ShawnBird 13 years ago

        If you are doing it for an employer it is at least worth what they are paying you for it. I would argue that qualifies as treasure.

    • flyinRyan 13 years ago

      No, in the programming world there are projects that met the revolving door of mediocre programmers that no one is proud of, no one understands how it works or wants to, everyone just finds a place they think will have the effect their being driven to make and takes a shot.

batgaijin 13 years ago

Hey edw519, I've read a lot of your posts and I was wondering if you could point me at a repo of some of your code; I'd love to read it.

  • Evbn 13 years ago

    Do you want to see Scott Adams's project status reports too? Just enjoy the stories.

  • swah 13 years ago

    "I never publish my code. Ever. Users get to give me feedback, but I don't give a shit what other programmers think. Sure, I learn from them, but never in the context of reviewing the code I wrote. I learn from the code of others and apply those lessons to my own work" (from here: http://news.ycombinator.com/item?id=2096007)

    • batgaijin 13 years ago

      So, he gets to comment on other people who publish their work, but he is forever safe from the same sort of feedback? That sounds more like fear than pragmatism.

why-el 13 years ago

I agree with you here. That project manager you mentioned is a lot of things to a lot of people. But I think as programmers we might want to agree on a set of standards that identify the good and the bad. I am one year or so older than Dan, and it would help my career to know that more experienced programs could identify who is the best among them.

  • pavanky 13 years ago

    This again depends on the domain and programming language you will be working on. But almost always the following line holds good.

    Make your code readable.

    • snogglethorpe 13 years ago

      I've had the fortune / misfortune of working with some very smart programmers, who could quickly come up with amazing and correct algorithms to solve difficult problems... but I found much of their code very hard to read; it wasn't "horror code" by any means, but it was often terse and tricky, and pretty comment-light.

      My theory was that because these guys were so smart, in many cases they overestimated the ability of others to comprehend what was clear to them, and as a result simply made their code too clever and omitted comments that might help clarify it.

      It was a definitely a valuable experience, though; besides the natural pleasure of working with very smart people, it really drove home the importance of actively pursuing clear and well-commented code! :]

      • mercurial 13 years ago

        Make no mistake. Clever code is not necessarily good code.

        I'm not in favour of littering the code with a pile of comments which will most likely become obsolete in three months, but it's very important to do whenever you are: - implementing a non-trivial algorithm - doing something surprising (maybe to fix something on a specific architecture or whatever) - implementing a complex business rule

      • Flow 13 years ago

        But their code could also be hard to understand because you don't understand the problem good enough.

      • Shorel 13 years ago

        Those algorithms should be left as is. They are good.

        However, they should be encapsulated in an easy to understand API.

        That way, you (the usual programmers) can call the code, and they (the very smart programmers) can write smart and efficient code. You are not supposed to tweak that smart code, just call it.

        The solution is not to dumb down everything. That way leads to madness. Or Java.

        • iends 13 years ago

          Fast forward a few years...

          None of the original developers are still at the company and one of your customers has discovered a bug in their implementation because of some obscure edge case and now you get to spend the next month understanding the complex code and writing a patch.

          Writing maintainable code is not the same as dumbing everything down.

          • Shorel 13 years ago

            Just the same as if someone finds a bug in Boost.

            It is hard to understand. It is efficient. It probably requires computer science knowledge to solve the issue. And yet it is as maintainable and well documented as they possibly can make it.

            Not everything can be 'business logic' in the sense of 'something a manager can understand but not code'.

            Some algorithms are just hard. And they are worth it.

            What would be Google without PageRank? What would be Skype without their LAN piercing modules? What would be iD without their game engines? What would be CryTek without their game engines?

            Worthless, that's the answer.

Ubiquite 13 years ago

To a maintainer programmer, the programmer who makes the simplest code.

  • just2n 13 years ago

    To an HR person, the programmer with the most number of years of experience.

    Here's to the technical interviewers out there who know all too well that there is no correlation between number of years of employment as a "software engineer" and the quality of the engineer.

gadders 13 years ago

> To a project manager, the programmer who hits every deadline (regardless of quality) is a good programmer.

Obviously not true, unless your project manager is a complete idiot.

  • Shorel 13 years ago

    The average manager is dumber than you think.

  • dkrich 13 years ago

    Not sure how you define idiot, but more often than not pm's have no formal programming experience which makes it difficult (though not impossible) to understand the value of well-engineered code. The only language they speak is dates, which unfortunately is usually accompanied by loads of unnecessary documentation.

    • gadders 13 years ago

      Presumably, though, a competent programmer would include the effort required to produce well-engineered code within his original estimate.

      • dkrich 13 years ago

        Yeah, but in my experience, the PM's response to that will be "can we get it done sooner?"

        If the estimated time aligns with what they want, then you're fine. But that's rarely the case and when things slip the code cleanup is pushed to the back burner.

      • vadman 13 years ago

        Code that was well-engineered 3 months ago may suddenly become lacking in light of a client having a brilliant new idea/requirement.

        And a programmer is not always in charge of his estimates. He may have to arrive at it together with his team lead who is under pressure from 2-3 project managers, thus only the minimal reasonable time will be allocated, without concern for architecture changes or refactoring.

crncosta 13 years ago

Thank you for so enlightening comment.

hnriot 13 years ago

You're making the point that being competent at programming is in some way relative to the perspective of the asker, but that's just not the case. Competence is absolute. There are traits of a good programmer that are immediately evident to any experienced programmer.

  • nateberkopec 13 years ago

    That's just like, your opinion, man.

  • lifeisstillgood 13 years ago

    Replace the word programmer with writer.

    What is absolute competence in writing novels? Writing magazine articles. Publishers want good writers that sell lots of books, young writers want good writers that critique their books.

    There is a base level of competence, but even that is often local culture

    • Draiken 13 years ago

      Even tho IMHO coding is an art, like writing, you cannot compare those two in this case.

      You write code that will almost for sure, live on for 10+ years and will be changed by a lot of people.

      Good code will be maintainable and easy to extend/change. Bad code is just... every programmer's nightmare.

      Bad code will still be bad even if it made the product go live, and good code will still be good even if it took a few more days/weeks to produce it. The balance between quality and speed is completely product dependent. But sooner or later bad/fast code will claim it's price.

      • rizzom5000 13 years ago

        This is spot on.

        And to go further, where the OP argued that product quality and development time are mutually exclusive; I submit that they are not.

        In the right hands, good code can be written quickly and efficiently, just as good novels can be written as quickly as bad ones are, or good music can be written as quickly as bad music is.

        • flyinRyan 13 years ago

          But most companies aren't going to have "the right hands". Many wouldn't want them even if they could get them because they want programmers they can replace easily.

      • beeneto 13 years ago

        I agree with your parent, and think you're trying to read it in an over-specific way, it's like saying "You can't compare writing and programming, because writing doesn't have comments."

        The parent was making the point that, like writing, good and bad coding style is entirely subjective - necessarily so because many parts of it are simply conventional.

        There are some specific constructions in programming that can be shown to be better than others through complexity theory, but even the guidelines we have for these aren't global optimums.

  • cobrausn 13 years ago

    Then why is there such variety of style, brevity, documentation, and technique among good, experienced programmers?

    • Draiken 13 years ago

      Even tho it's not a tangible thing, it still exists.

      You can't measure it with a ruler or some lines of code formulae, but good programmers are easily recognizable by other good/experienced programmers.

  • ww520 13 years ago

    Competence is in the eyes of the beholder.

    If I need someone to crank out a report by afternoon which will never be used again and he was able to do it, he's very competent. If I need someone to crank out a car control system and he took one year to do it but has very low defects afterward, he's very competent.

  • john_flintstone 13 years ago

    >There are traits of a good programmer that are immediately evident to any experienced programmer.

    Replace the word 'programmer' with 'coder' and you might have a point. Whenever I hear the word 'coder', all I can think of is shelf-stacker. A coder writes lines of code, a programmer builds products or 'things'. All the rules and standards regarding code belong to coders - they have nothing to do with finished, shipped, or successful products.

    But what do I know? I've only been building products for 13 years. And I'm drunk.

  • siganakis 13 years ago

    If competence is absolute, then there should be some way that you can objectively measure it (otherwise how do you know its absolute?).

    What are the ways to objectively measure the competence of a programmer?

    If that was the case, then it would be much, much easier to hire and fairly compensate programmers than it is in reality.

    • nadam 13 years ago

      In my opinion programmer competence is not absolute, but a little bit more absolute than what ed's post suggest. :)

      A very rough measurement of programmer competence:

      The programmer is given a product specification. He creates the program in T time using S size of code.

      1/(T * S * S)

      is a very good approximation of how good the developer is. (small size is more important than the taken time, that's why I've taken S square. We can tweak the formula of course. Maybe 1/(T * S * S * S) is even better in some cases.)

      TL;DR: the most common thing amongst good programmers in my opinion is that they are masters of the DRY principle, but they do not overabstract; in essence they write smaller code to problems (usually even faster) than not so good programmers. The bigger the system is, the more and more architectural/design skill is needed to keep the code base small.

      • EwanToo 13 years ago

        I have to disagree sorry.

        If a piece of software is needed by the date of a major launch, and a programmer doesn't ship, all because he wants to reduce the amount of code involved, then he's an awful programmer as far as the business is concerned.

        Running over time can cost millions of $ of investment in other areas of the business:

        - Press organised

        - Advertising purchased

        - 1000s of hours of staff training underway

        - Suppliers informed of increased demand / new supplies purchased

        - Customers told to expect delivery by date

        Any one of these areas can cost 10x or more of the cost of developing the code.

        If you're not writing code which would be affected by that kind of criteria then cool, go for whatever metric you want to define.

        Time taken is almost always the number one criteria of any business requirement, or to put it another way, small size of code means almost nothing to anyone except the original developers.

        • nadam 13 years ago

          I said that it is a rough estimate, and we can tweak the formula. My opinion is that programmer competence is not absolute, but also not terribly relative. I mean John Carmack is kind of absolutely a better developer than let's say junior average Joe.

          >small size of code means almost nothing to anyone except the original developers.

          No. Small size reflects the quality of the code: It reduces the time of future developments (non DRY code keeps growing agreessively and becomes even more non DRY and very time consuming to develop new features into). It is an investment in the future. Now you are right: sometimes it is not worth it to invest into the future, because maybe the code will be thrown away because it will turn out that the startup/product is not viable. Somtimes you know that product has a stable growing market and you will have to develop tons of features into it in the future. Then investing in the future is very important.

          • randomdata 13 years ago

            I think I understand where you are coming from, but DRY tends to, at least initially, increase the size of codebases and development time. The programmer who hacks something together that works now, but is a nightmare to maintain later will score better in your formula. As you say, it is an investment in the future, which implies that you are giving something up now for something more later.

          • mercurial 13 years ago

            > Small size reflects the quality of the code.

            Not always. Case in point: a week or two ago, I refactored some C# code. It was an installer generator, which was coded entirely in the controller. Yeh who want to add unit tests, abandon all hopes.

            So the code is now split into different pieces, according to responsibilities, with dependency injection, and I/O in its own layer. The result, in terms of lines of code, is a net increase. But according to your metric, I have decreased the quality of the code.

            I agree that generally speaking, less code is better than more code, but more code can mean reusable, more readable code.

            • nadam 13 years ago

              Ok, I accept this. I have experience in refactoring really bad code. Refactoring these always led to smaller code: yes sometimes some of the refactorings increased the code size, but there was enough redundancy because of the bad (or no) abstractions and design mistakes in the original code which compenstated for it.

              The bigger the system is, the more probable it is that you can make it better while decreasing the code size. Above 10.000 lines a bad code usually is not DRY enough so much, that it is very easy to decrease its size while increasing its modularity.

              Yes, code size is not a perfect indicator of quality. But reducing code size is a very central part of my design philosophy. When you very conciously refactor to smaller code size (using good design patterns) the code and the abstractions in your head can become incredibily clear.

              For example I write a software which deals a lot with rectangles. In the beginning my rectangles had four properties: left, right, top, bottom. After a while I've found out that my code gets more and more redundant; I have to find an abstraction which relies on the symmetries in the problems. So now my rectangle has this interface to get and set the 4 sides:

              void setSide(bool vert, bool isEnd, int value)

              int getSide(bool vert, bool isEnd)

              Not only my code size reduced dramatically, but because of this new abstraction I've understood the problem much better!

    • kd0amg 13 years ago

      I don't see why an objective ordering of programmers by competence would have to be a total ordering.