Hacker News new | past | comments | ask | show | jobs | submit login

> we actually removed more lines than we added

My best year, I removed 10,000 lines of code more than I added without removing any functionality from the project (and in fact adding some new features). It isn't always a good thing to do this- but when it is, you know it as soon as you start reading the code.

I often wish I could be paid just to refactor and rewrite existing code bases to make them more maintainable.




> I often wish I could be paid just to refactor and rewrite existing code bases to make them more maintainable.

Yeah, me too--I'm very good at it and it's quite satisfying. Unfortunately it's very hard to communicate the business value of it (although the business value is huge in some cases).


Give me a ring if you all ever find a place that lets us use our powers to their fullest. I feel like realizing removing more code that you put back is usually a good thing is a tipping point in a coder's career.


Ironically, programmers should strive to write the least amount of code as possible, while reading as much code as possible.

If we can solve a problem without writing any code at all, then that's the most maintainable and bug free solution.

See "The Best Code is No Code At All": https://blog.codinghorror.com/the-best-code-is-no-code-at-al... .


Quoted for emphasis:

> Every new line of code you willingly bring into the world is code that has to be debugged, code that has to be read and understood, code that has to be supported. Every time you write new code, you should do so reluctantly, under duress, because you completely exhausted all your other options.

It's worth noting: code you import counts toward your total line count. Don't think that because someone else who doesn't work with you wrote the code, it doesn't count. In some ways, that's worse. I've spent all day today debugging a no-longer-maintained library which is used in a legacy codebase I'm maintaining.


See also smr.c from http://www.ioccc.org/years.html#1994 (the world's shortest quine!).


That may be one of the best things I've seen all week.


This is commoditization. People "tried and reinvented" the wheel many times back in the days out of lack of time, knowledge, legal/licensing, essential features, trying to be smart or many other reasons. And then there are more libraries today that solve the same thing way better. That automatically makes all the old ones legacy. Its like inflation, why take money away from people when you can print new ones?

Today, while I love the simplicity of Go, I shudder to fathom how much copy-pasted lines of Golang code I wrote will be commoditized in next year or two, and thus automatically creating legacy. And there will be nobody to give a ring to except my past self.


I spot a pattern with these replies. Perhaps they could be grouped together in their... ha, yep, I'm another one - put me on that there list too eh.


If we wish to count lines of code, we should not regard them as "lines produced" but as "lines spent" - Dijkstra


I've sometimes thought about setting up a consultancy that would do just this.

Was your code written by amateurs? Are you running your 50-person office off excel? Give us a call.


Clean up of anything, be it your code base or home, always feels good. Reminds me of my favorite quote:

One of my most productive days was throwing away 1,000 lines of code. -Ken Thompson




Consider applying for YC's Spring batch! Applications are open till Feb 11.

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

Search: