Ask HN: Do you ever get asked how many LOC (lines of code) a project will take?

3 points by jaequery ↗ HN

5 comments

[ 1.8 ms ] story [ 27.0 ms ] thread
I’ve met a Project Manager whom I saw ask for LOC to her developers on every single task of a project before having them start working on it. Mainly to estimate how much it’d cost.

But is this the best way to measure estimated costs?

What are the better alternatives if any?

Just off top of my head, I can imagine how copy paste codes can skew the numbers greatly, especially on the front end side.

But she insists this is how most top coders do it. I don’t know what to think of that, seems kind of silly if you ask me.

Estimating cost of code in LOC doesn't account for the fact that:

- Some kinds of code are harder to write than others. For example, it could take days to develop a tricky algorithm that's just a few lines of code.

- A developer who is familiar with a code base can write lines of code faster than one who isn't.

- A developer who is experienced with a language can write lines of code faster than one who isn't.

- A better developer may be able to write the same logic in fewer lines of code (e.g., by factoring out common code as methods instead of copy/pasting, or not reinventing functionality that already exists in standard libraries).

I've been programming for decades and have never been asked to estimate cost in LOC. Estimates are always requested in terms of time (e.g., hours of work), or in some unit that's related to time, such as "story points" in Agile methodology.

In a company developers are fixed costs. Therefore estimating time is equivalent to estimate cost.

Requesting to estimate LOCs makes no sense. Worse, as any metric developers may be assessed on it can only lead to manipulations (i.e. wasting time on making code longer/shorter to fit the estimate).

I've never heard of such policy. Unfortunately (sorry to be blunt) often the "project manager" is the most clueless person the technical team has to deal with, and managing the project manager is a skill.

sounds like a pretty poor metric to me, surely estimated time not lines of code would be better, a line could be 5 characters or 50 but not only that it fails to account for time to think of the best solution to a problem

asking someone that kind of bids them to their answer, like a word count on an essay it forces people to either cut back or add in extraneous crap to meet the required count

how would this manager react if the work was delivered in time and did the job it was supposed to but either fell very short of or far over the original estimate

It's an extremely crappy way of measuring costs, and I've never heard of anyone using it for estimates. (And people using it as a measure of productivity are fairly universally mocked for it: "Great, I'll copy-paste me a bonus this afternoon!")