Settings

Theme

Going Fast Slowly

varnish-cache.org

137 points by mro 10 years ago · 28 comments

Reader

kazinator 10 years ago

Looking at the static picture is somewhat misleading. The lines of code you see in the current baseline snapshots are not all the lines that were ever written for that project.

A fairly large and extensive commit affecting many lines can have a small impact on the absolute number of lines (which can even shrink). We change as well as delete existing lines, not only add new ones.

The lines which are replaced by new lines should be regarded as deleted lines, and so the figure of how many lines there are now should be supplemented with how many lines were deleted since the beginning of the project: how many additional lines of code exist in the repo's history, which no longer appear in the current baseline.

The invisible lines that disappeared in the history are the underpinning for the current lines; they enabled the new lines to be figured out, which took work. Someone had to write each line, and it has to be counted in the LOC output.

It is not entirely clear cut. If you make a trivial change in some existing line, it's not the same thing as a brand new line. Yet, according to the line-based diff tools, it looks like a deletion and addition of an entire line. Minus this, plus that.

bluedino 10 years ago

>> Varnish has been in existence for 10 years, so that's 15K lines per year. 200 workdays a year makes that 75 lines a day. 7.5 hours of work per day gives 10 lines per hour.

You can't really say that, though.

Let's roll back the clock to when the project was new and say, only 10k lines of code. Maybe that first 10k was written in a month. Fleshing things out, then adding features like crazy. Coding in a euphoric state.

Once you've reached a certain amount of code, you're doing maintenance. Fixing bugs. Re-factoring code. I can see 10 lines of code per day. I notice that in my own projects. I might write a few thousand lines in a week and then as time goes on, I write a few hundred, then a few tens, then maybe just a couple edits.

  • taneq 10 years ago

    Exactly. One of my past jobs was maintaining a mature codebase that had been under incremental development for over a decade. Most of the bug fixes I made involved anywhere from 2 hours to 2 days of investigation, usually followed by a one or two line change.

  • andrewchambers 10 years ago

    > Coding in a euphoric state.

    You must be fun to code with.

bronson 10 years ago

"I no longer think about code lines as an asset to be accumulated, but rather as an expenditure to be avoided."

Good quote. Took me until my 30s before I started realizing this myself. Seems obvious in retrospect.

  • haberman 10 years ago

    “Measuring programming progress by lines of code is like measuring aircraft building progress by weight.” -- Bill Gates

  • javier2 10 years ago

    I'm only one year out of uni and I figured this too. Lines of code are features and state that will increase the cost of other new features. So adding lines is a cost. The hard part is figuring out what lines of code (features) to add, do them well, and which ones you should not even make.

  • pdonis 10 years ago

    Obligatory EWD reference:

    http://www.cs.utexas.edu/~EWD/transcriptions/EWD10xx/EWD1036...

    ...if we wish to count lines of code, we should not regard them as "lines produced" but as "lines spent": the current conventional wisdom is so foolish as to book that count on the wrong side of the ledger.

    2 December 1988

  • GolfyMcG 10 years ago

    A practice we've implemented to manage this is tagging pull requests that have anything over 250 added (green) lines of code. Before anyone is willing to give you a code review, you have to justify why such a pull request requires so many lines, break it into multiple pull requests, or refactor your code. Often times, it makes review easier because the PR's are smaller and enforces a simple baseline that tells the programmer, your code is too big!

    • Joeri 10 years ago

      Maybe all diff views should show added lines in red and removed lines in green. If anything, it would help create awareness of the need for more compact systems.

bracewel 10 years ago

> The two CVEs against Varnish were both utterly bogus "trophy-hunter" CVEs in my opinion. (But don't take my word for it, judge for yourself.)

ok

> CVE-2013-4484: Varnish before 3.0.5 allows remote attackers to cause a denial of service (child-process crash and temporary caching outage) via a GET request with trailing whitespace characters and no URI.

:|

_snydly 10 years ago

>> And eventually I no longer think about code lines as an asset to be accumulated, but rather as an expenditure to be avoided.

Maybe I'm a bit odd, but I got into programming with code golf, using lots of J, K, and others. So my growth has been the opposite. It was just last year that I realized it's okay (and maybe necessary?) for other people to read/understand my scripts.

  • siscia 10 years ago

    Even if slightly correlated I believe you are talking about a different issues and scale.

    It is definitely good if other people can read your code, so you use great name convention and maybe add comments here and there, but is definitely better if people don't have to read your code because your code simply doesn't exist.

    If you can achieve the same result with a careful design, a lot of hours of thinking and very few hours of typing, supposing that the design and the code is understandable by your peers, your code will be "more valuable" that if you achieved the same result with a lot of code.

    Code is a liability is not ab asset.

    • _snydly 10 years ago

      That's true, I shouldn't have compared my experience as a grad student in science to a project like Varnish.

      > Code is a liability is not ab asset.

      That's a great quote. I guess there's a sweet spot. Maybe, if only a handful of people need to be able to understand what you wrote, then the sweet spot can be skewed toward the terse end of the spectrum.

  • lomnakkus 10 years ago

    > It was just last year that I realized it's okay (and maybe necessary?) for other people to read/understand my scripts.

    Have you never found yourself in the position of not being able to read/understand your own code/scripts? (Though, I guess if it's so compact as K/J and very in-grained, I guess it might be possible to get the overview pretty quickly?)

    Just FWIW, I'm in the position that other people definitely need to read/understand my code/scripts. After running git-blame I sometimes really hate past-me.

kazinator 10 years ago

Slovak proverb: "ponáhľaj sa pomaly" -- Be not hasty, when you hurry.

  • titanomachy 10 years ago

    English has "more haste, less speed" which I think carries the same message.

    • kazinator 10 years ago

      What I don't understand is why the most literal translation into English, which is equally succinct, doesn't "work" somehow. Namely the translation: "hurry slowly".

      It's just so awkward. Yet the grammar isn't bad; there is nothing wrong with "walk slowly" or "eat slowly".

      "Ponáhľaj sa pomaly" is perfectly euphonic to the Slovak ear, while "hurry slowly" seems clumsy somehow. We need to make it more sophisticated somehow, like "make slow haste", or "slow haste makes faster" or whatever.

      What is the reason ...

      I suppose; if everyone said "hurry slowly!" it might wear into usage.

    • adamtj 10 years ago

      I'm told that the US military uses the phrase "Slow is smooth, smooth is fast."

  • schoen 10 years ago

    It also exists in classical Latin and Greek:

    https://en.wikipedia.org/wiki/Festina_lente

  • gandalfu 10 years ago

    Spanish: visteme despacio que tengo prisa

    Or: visteme despacio que ando apurado

FrankyHollywood 10 years ago

EWD talks about lines of code as "lines spent" instead of lines produced, this is 1988 :)

https://www.cs.utexas.edu/~EWD/transcriptions/EWD10xx/EWD103...

0x07c0 10 years ago

I really like Douglas McIlroy concept of negative code.

Also, the varnish source is really nice! Pen kode ;)

http://programmers.stackexchange.com/questions/103807/what-i...

sosuke 10 years ago

Using git can you also see the times a single line was changed? I bet the numbers jump quite a bit. Sure you've got a 200 line program but over time you've written 20k lines!

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection