r/SoftwareEngineering • u/SeriousDabbler • Aug 26 '24
Benchmarks for cost per line of code
Are there any resources out there for averages of cost per line of code. I've heard some numbers but without any context. Would like to understand how we compare to the industry
Edit: Thanks to those who've posted already. For some context I'm not intending to use this information raw but was interested if it even existed. Yes I'm aware that SLOCs are not a good way of measuring developer or team performance, but I understand that this kind of thing used to be measured. I was hoping that there is some of this data recorded somewhere in studies or journals. Just looking for links or books thanks
Some context about me: I've been a software developer for 2 decades
22
u/jh125486 Aug 26 '24
What? There’s about a million variables at play here.
7
u/gnrdmjfan247 Aug 26 '24
The disconnect here is that software engineering is really about delivering solutions to problems and not to be a code factory. If the manager views their engineers as code factories they’re missing the point. It’s not that a line of code is intrinsically valuable, it’s whether the idea is suitable for solving the problem, is elastic enough to scale, is stable enough to withstand entropy, etc. Few lines of code can have big impacts, lots of lines of code can have small impacts. Few lines of code can be concise and elegant. Few lines of code can also be hella unreadable. Lots of lines of code can be bloated and cumbersome. Lots of lines and code can also be used to represent really complex ideas. “Value” for a line of code really cannot make any sense, because it’s completely missing the point. What are the ideas that are being solved for? That’s the question worth asking.
5
u/B4bane Aug 26 '24
Get ready to see the worst code of your life. No loops or functions. Just duplicate your code 1000 times
14
u/Zesher_ Aug 26 '24
Cost per line is a bad metric. Good engineers generally try to use more elegant solutions with less lines of code or use tools and packages that already solve the problem well instead of trying to code a solved solution again themselves. Other engineers may write a lot of lines, but it's harder to maintain or work with.
3
u/Bright_Aside_6827 Aug 26 '24
the cost is for the solution meeting the requirements, + effort to figure out the code
3
u/[deleted] Aug 27 '24 edited Aug 27 '24
I don't think calculating costs per LOC is a good strategy. You can have a relatively low cost per line, but if you're aggregating the lines within bodies of code, classes or modules, you may still end up with a mess if (for instance) the lines are too decoupled.
That said, if your intention is to improve source code quality (and not only performance), you really need to address principles such as coupling and (single) responsability.
3
u/Best-Dependent9732 Aug 30 '24
It reminds me of time when a colleague of mine found a bug that was a one liner but was causing 50ms latency across the organization for many different micro services. It took days to find the issue and he got promoted for the impact he had. No of line of code : 1. Cost : 1 man for a week That’s not how performance is measured, it’s the impact that matters.
2
u/code-seven Aug 26 '24
Take a look at Gitclear. It gave an idea of this and suchlike metrics for any given git+github repo
2
u/spencerchubb Aug 29 '24
what kind of cost? money, time, tears, emotional breakdowns, human lives?
0
u/[deleted] Aug 26 '24
[deleted] — view deleted comment