-2000 Lines of Code (2004)
folklore.org
folklore.org
It's in Pascal and 68k assembly, and I find it quite beautiful. Especially the Pascal code, as it is broken up into clear, concise functions so it is easy to understand what is going on.
CSS seems to be really bad for this, but that might be because the frontend coders I have met are crappy. Rather than decrease the padding they'll ADD more css to move all of the elements, then they end up with !important rules everywhere.
I've been doing frontend web coding for more than 5 years now, and I have only had to use !important probably 3 or 4 times, and only them it was to overwrite things in stylesheets that we had no control over.
This is natural, if you think about it. Let's say we have a body of code which fails for an edge case. Without understanding the code too deeply, most programmers can find a way of hacking in special handling for the edge case. This process can repeat for quite some time before a codebase collapses under its own weight.
It takes significantly more brainpower to re-analyze the entire problem and come up with a coherent, elegant solution for the expanded problem definition.
Generally the the generalization applies
;)
"Technical debt" is a major product killer.
Essentially, you could be a great developer and you could still output low quality css simply due to the way css was designed.
This is a skill, and I've been consciously working to improve it. I think the key questions are "Do I really need to write this now?" and "Is there a simpler problem I should be solving instead?"
Having a high sloc number isn't necessarily good. Nor is having a low one.
Coding for readability and performance often results in fewer lines of code, but that's not a two-way street; coding specifically in order to reduce sloc doesn't magically make your code quicker or more readable.
I also think the readability argument is overused. I definitely value readability, but I rarely see aggressive code re-use lead to significant-enough readability challenges to warrant not doing it. More often the before/after are both pretty readable, and the after has half as many possible test-cases.
[Edit (almost immediately): Nevermind. I don't think anything I said is in conflict with anything you said. I probably ought to take the approach I have to code and apply it to commenting.]
- If I debug this code, will there be meaningful intermediate values? (One clever line of code might lack those)
- Can a less experiences developer understand what this does?
My rationales:
- More SLOC means more places for a bug to hide.
- More SLOC means more logic to have to reason about.
- More repetition leads to more SLOC.
- More repetition increases the chance that a bug can be fixed in one spot but not in others.
- More repetition increases the chance for regression bugs resulting from updates not being fully propagated
Anecdotally, on my team it seems that we tend to have the least quality issues in the stuff that's written by folks who produce the most factored code.
- Fewer SLOC means more code fits on one page.
- Fewer SLOC means it may be easier to explain/document/remember what it does.
IBM (1988) ... The existing code tended to shrink when I edited it. I wrote a total of minus 5000 lines of code that summer.
Oracle (1989-2006) Oracle's code (C and PL/SQL) is very good. It usually didn't shrink when I edited it.
That's always stood out for me, and whenever I hear that Bill Atkinson story, I'm reminded of it.
(pause)
I've just done a search and I can't find it. Are you sure?
http://www.hnsearch.com/search#request/all&q=folklore.or...
Doesn't seem to turn up anything. Do you remember what the other title was?
The next step is to not submit the article at all. Then we will be truly enlightened.
I do, for one.
http://news.ycombinator.com/item?id=3970011
http://news.ycombinator.com/item?id=2856567