Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.



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.


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.


> 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.


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!


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.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: