[HN Gopher] Code Budgets
___________________________________________________________________
Code Budgets
Author : DanielBMarkham
Score : 18 points
Date : 2021-01-16 11:57 UTC (11 hours ago)
(HTM) web link (danielbmarkham.com)
(TXT) w3m dump (danielbmarkham.com)
| chrisandchris wrote:
| So are we back to counting lines of code as measurement for
| productivity, success and cost? Does that mean someone who writes
| cleaner code using a bit more lines is less good than someone who
| writes less code but also less unreadable (assuming in many cases
| slightly more verbosity leads to more cleaner code).
| restalis wrote:
| Talking about the cost for a line of code is like talking about
| the cost for a line of blueprint design. Forcing cost evaluations
| for non trivial problems is like forcing a curved surface onto a
| plain map. It may be considered doable if admitting a high enough
| level of error, but it's just a pain to do it, every time.
| megameter wrote:
| I'll happily take on the challenge, in fact I've already done
| this on past projects. The "code golfing" complainers have no
| sense of how much a codebase can be a maintenance sink, and how
| you could easily attain 100-fold line reductions for some things
| if you just took the problem seriously and aimed towards defining
| languages that suit it. See VPRI's "STEPS" papers for examples.
| pso wrote:
| When you say 'defining languages', do you mean as DSLs or
| choosing appropriate existing languages? If DSLs, which
| language would you recommend for creating DSLs. Could you give
| a successful example?
| 5tefan wrote:
| Budgets don't support anyone getting the job done. It's a
| business metric and serves as a halting line, early warning,
| decision taking line... whatsover. I dislike the KPI mindset. I
| prefer common sense, understanding what's really needed to
| deliver something reliable that behaves as expected from the
| customer's point of view.
| l0b0 wrote:
| tl;dr: The only way to limit the cost of solving a problem is to
| limit the LOC count allowed to the developers.
|
| This ignores real world issues:
|
| - It is utterly trivial to work around this one, since every
| popular language lets you write an abritrary amount of code in a
| single line. In fact, your entire application could be a single
| line of code, easy!
|
| - When you enforce KPIs, the only people who will stay are the
| ones who agree with the KPI (code golfers) or know how to work
| around it (see above).
|
| To extend this idea to its logical conclusion and work around
| both the issues above, why not limit the number of _characters_
| the developers can use? Because every single name in the
| application will be a single character, making maintenance a
| nightmare.
|
| Let's continue the above list for fun:
|
| - Automated tests are code, so they would limit the budget of
| production code even further.
|
| - Infrastructure as code is out the window, for the same reason.
|
| This is an awful idea.
| UK-Al05 wrote:
| Line budgets sounds like an awful idea. Code golf!
|
| I'd rather have 20 lines of clear simple code then, 5 lines of
| dense complicated code.
|
| Budgets will just make people write dense code.
| KronisLV wrote:
| Think there would be another metric that would be better?
|
| E.g. a readability score for the code, one that could be
| composed of analyzing the cyclomatic complexity (
| https://en.wikipedia.org/wiki/Cyclomatic_complexity ) and other
| factors that affect how easy/hard it is to read and understand
| it?
|
| Or would most such attempts be deemed to fail because of how
| abstract code is and how hard to evaluate automatically it can
| be?
| bobthepanda wrote:
| Lots of reasonable metrics become bad once you make them a
| target.
| BenoitP wrote:
| What we want could be a complexity metric corresponding to a
| set of lines.
|
| I'd say that's something that could be ML-learnable with the
| right dataset.
|
| Given an answer from stackoverflow, ask an average developer to
| identify what was the question from a set of say 5. The average
| time taken to provide a right answer would be the complexity
| score.
|
| You could use a transformer trained on code, and make it
| transfer-learn a function approximating that score.
| draw_down wrote:
| This doesn't account for the cost of dependencies (an import
| statement is only one line!), so this mindset would result in
| taking on big dependencies to limit "lines of code".
|
| You must be very careful about dependencies. I'd sooner take a
| rule to arbitrarily limit dependencies than lines of code.
| [deleted]
| blakehaswell wrote:
| I agree. I don't think lines of code is necessarily the right
| thing to budget, especially if you limit it to "lines of code
| written by our team".
|
| But there is something interesting in this idea. Our software
| is growing immeasurably complex. We're piling on more and more
| layers of abstraction. Ostensibly the goal is to make our lives
| easier. But in reality we've got companies throwing hundreds or
| thousands of developers at the problem of building a wiki or a
| social network, and they end up building these Rube Goldberg
| machines where 99% of the effort is spent on things other than
| the actual problem users want the software to solve.
|
| Moore's law has been totally offset by Wirth's law[0], and as
| an industry I don't see us doing anything about it. Even if
| lines of code is the wrong constraint, we could do with
| learning how to do more with less.
|
| [0]: https://en.wikipedia.org/wiki/Wirth%27s_law
___________________________________________________________________
(page generated 2021-01-16 23:02 UTC)