News for hackers. Stuff that matters.
Re:Repeating Yourself Thrice Doesn’t Turn You into a 3x Deve... by lovasoa on Sunday July 30, 2023 @01:01PM (#36933292)
It's not just writing the code. Writing the code is easy. It's maintaining it. And then debugging it. There is a limit to how many lines of code a single person can maintain.
Re:Repeating Yourself Thrice Doesn’t Turn You into a 3x Deve... by hyperman1 on Sunday July 30, 2023 @01:19PM (#36933534)
In my experience, the limit does not depend on the volume as such, but more the complexity. This complexity can be intrinsic frombthe business domain, or accudental from technical choices. If frontend, backend and storage have parallell structure based on predictable patterns, the triple line cost is easily ignorable by skimming.

Development heavily slows down under unpredictability. Maintainance is slower partially because knowledge loss hightens unpredictability. One-off half-documented pseudo-frameworks create much higher knowledge loss in maintenance, and are a much worse time eater than simple code, even if tripled.

Re:Repeating Yourself Thrice Doesn’t Turn You into a 3x Deve... by vendiddy on Sunday July 30, 2023 @01:38PM (#36933768)
Relevant quote from the book "A Philosophy of Software Design"

Complexity is what a developer experiences at a particular point in time when trying to achieve a particular goal. It doesn’t necessarily relate to the overall size or functionality of the system. People often use the word “complex” to describe large systems with sophisticated features, but if such a system is easy to work on, then, for the purposes of this book, it is not complex. Of course, almost all large and sophisticated software systems are in fact hard to work on, so they also meet my definition of complexity, but this need not necessarily be the case. It is also possible for a small and unsophisticated system to be quite complex.

Re:Repeating Yourself Thrice Doesn’t Turn You into a 3x Deve... by lovasoa on Sunday July 30, 2023 @01:34PM (#36933717)
Hey, I'm Ophir, the co-author of the post, and main contributor to the SQLPage one-off half-documented pseudo-framework :)

I'm not sure if you had a look at what SQLPage really does. It is not a framework in the same sense as Django, Rails, or Laravel. It doesn't have a large set of functions you need to interact with.

It lets you write the database queries you would have written anyway to get data out of your database, and just renders that as a nice frontend. All the components you can use for rendering are heavily documented with many examples on https://sql.ophir.dev/documentation.sql

Re:Repeating Yourself Thrice Doesn’t Turn You into a 3x Deve... by hyperman1 on Sunday July 30, 2023 @04:26PM (#36935593)
OK, here is a severe misunderstanding brewing. I definitely did not mean SQLPage when I said one-off half-documented pseudo-framework. In fact, I did not mean any real, standalone, named product with this. I do however see very much how you could think so from my description, so my apologies.

What I meant: consider any random big software development. It might be mind-numbingly boring, very technically repetitive, you might have devs who never did any maintenance, or devs being expensive got the command to start building something anything while the business has yet to start delivering something resembling requirements.

In this kind of case, programmers tend to start building abstractions based on their imagined needs, with an We-will-add-the-business-stuff-later attitude. The results are generally some kind of architecture astronaut horror. Abstraction will be very high, weird features and handling of useless corner cases will abound. In-code documentation, logging, debugging features will be absent. Higher level documentation was either not written or lost long ago. That's your average one-off half-documented pseudo-framework.

I've seen plenty of these (and committed a few crimes of my own). From the top of my head, some of the worst:

* A full-blown 3000 lines templating library, for rendering exactly 1 report that was basically a for loop dumping an sql query to a html file.

* A C10K database connection manager built on top of apache commons pooling (which while a good library was not fit for this purpose at all), hyperoptimized for TCP port open/close speed, for an application making at most a few connections per minute.

* A cache manager for files, deciding when to remove a file based on either AI or linear regression, with a web UI for configuring this decision and all the zillion config parameters and strategies, but the time to generate the cached data was shorter than the time to read it from disk and the files easily lived for months.

* A java message building code that did everything humanly possible to only allocate a big buffer once at the beginning because 'GC is too slow', but the coder forgot how joining strings together created temporaries that were of course cleaned up by the GC.

Needless to say, the people maintaining these beast cursed the devs who implemented them, and tended to rip them out on sight if possible, or pay the very heavy maintenance cost.

Re:Repeating Yourself Thrice Doesn’t Turn You into a 3x Deve... by whstl on Sunday July 30, 2023 @04:42PM (#36935749)
"In this kind of case, programmers tend to start building abstractions based on their imagined needs, with an We-will-add-the-business-stuff-later attitude"

I wish I could publish examples from my current codebase, because that's exactly what happened. Difficult and verbose abstractions, with sometimes 50 classes being involved in displaying a simple table (one class per column display, one class per filterable column), and that's just the "R" part of CRUD.

And there are 6 or 7 different teams working on it, and each one uses different methodologies to do their work. In some cases it's abstractions on top of GraphQL.

Everyone involved had the best intentions possible, but the end result doesn't reflect it.

Re:Repeating Yourself Thrice Doesn’t Turn You into a 3x Deve... by simonw on Sunday July 30, 2023 @01:23PM (#36933580)
"There is a limit to how many lines of code a single person can maintain."

I used to believe that, but I don't think it holds true any more.

The trick is to write code with automated tests and comprehensive documentation.

If you do this, you can leave projects in a state where you can pick them up in the future as if you weren't the original author.

Re:Repeating Yourself Thrice Doesn’t Turn You into a 3x Deve... by lovasoa on Sunday July 30, 2023 @02:25PM (#36934357)
It's true that if all the code works well, is tested and all the features are supposed to stay the way they were when the code was written, then, any developer can maintain any amount of code, there is just nothing to do.

The problem arises when there is a change in what we want the code to do. Changing a feature that is implemented over three codebases in three different languages is definitely much more work than updating something that was written in SQLPage, for instance.

Re:Repeating Yourself Thrice Doesn’t Turn You into a 3x Deve... by lovasoa on Monday July 31, 2023 @03:37AM (#36939734)
Oh, I hadn't noticed your username! On the topic of maintenance: could you have a look at this pull request I opened three years ago on a repo of yours : https://github.com/simonw/datasette/pull/1159 ?
Re:Repeating Yourself Thrice Doesn’t Turn You into a 3x Deve... by simonw on Monday July 31, 2023 @02:57PM (#36947229)
Hah, wow, it looks like I've been procrastinating on making a decision if I like that or not for three years!

I'll add it to the Datasette 1.0 milestone so it definitely gets my attention before shipping that release.

Re:Repeating Yourself Thrice Doesn’t Turn You into a 3x Deve... by delusional on Sunday July 30, 2023 @01:15PM (#36933460)
No there is not. A line of code takes no resources, has no overhead, requires no upkeep. I think you may be referring to the drag complexity imposes in future development. That I agree with, but LOC is a poor proxy for complexity, and code that is static costs nothing.
Re:Repeating Yourself Thrice Doesn’t Turn You into a 3x Deve... by klodolph on Sunday July 30, 2023 @01:38PM (#36933769)
Saying “a line of code requires no resources” can only be true under a particular set of assumptions and particular system for accounting. It’s not a useful or interesting argument by itself, because it doesn’t explain the assumptions and accounting system that it implies.
Re:Repeating Yourself Thrice Doesn’t Turn You into a 3x Deve... by fragmede on Sunday July 30, 2023 @01:29PM (#36933654)
Every line of code has an overhead; has a chance of bugs, and demands upkeep just for existing. Having class A, class B, and class C, that do almost the same, but slightly different thing means that when the business rules change, that you have to be sure that similar, but slightly different changes to class B and class C, which aren't neatly going to be self-contained in B.cpp and C.cpp (or .py, .rs, .rb; you get the point) have to be made, and then you can't ever be sure that A.cpp doesn't also have some long-forgotten but similar and crucial bit of functionality that this one customer relies on (because that was written before TDD became popular).

---

LoC itself is a bad proxy for complexity, but I think taking the log of the number of LoC tells you enough to build some expectations. A codebase where log LoC is ~6 (so in the neighborhood of ~1M LoC) is different enough from one where log LOC is ~3 (so ~1,000 LoC) that you have an idea of what you're getting into if someone asks you to make a change to either one of those.

Re:Repeating Yourself Thrice Doesn’t Turn You into a 3x Deve... by delusional on Sunday July 30, 2023 @01:48PM (#36933914)
The key to understanding our (apparent) disagreement is:

> that when the business rules change

Yes, when things change complexity has a cost. The inverse is also true however, if nothing changes, it has no cost. If class A, B, and C do almost the same thing, then nobody cares because the computer will gladly execute almost the same thing in different locations in memory. The modern computer built today is essentially perfect. It will execute the same thing every time, it will not suddenly require changes because there was some degradation in an adder, and no cogs need changing. All the maintenance is stuff we make up because we want it to do something it never did before.

Re:Repeating Yourself Thrice Doesn’t Turn You into a 3x Deve... by fragmede on Sunday July 30, 2023 @02:30PM (#36934413)
A friend's friend's company absolutely relies on this bespoke computer program running on an un-networked desktop computer running Windows XP from the 2000s. There will be a degradation in its hard drive, its power supply, its fan; something. All the lines of code that comprise that program (which are lost to the sands of time) are a liability because that code has been lost. All we can do now is virtualize the application and move it to newer hardware that isn't on the verge of failing. Rewriting the app is out of everyone's budget so that's all we can do, and hope for the best.

The lower the log LoC of their Visual Basic app, the easier it should be to replace and rewrite atop a modern tech stack.

If it ain't broke... you point out. It's old and creaky, and everyone's just afraid of the thing. There's no real backup (working on that!), there's no accessibility to it from the Internet - looking up info on that computer via a smartphone or tablet would be a boon to the company. It's absolutely load bearing, but it's like a bridge that's too small for the city that's grown around it.

The world moves forwards around software that's sat in place, so the software wants to move as well. We're not "making up" maintenance stuff just for the hell of it. Unless you work on the same chair and desk you used when you were 5.

Re:Repeating Yourself Thrice Doesn’t Turn You into a 3x Deve... by Supermancho on Sunday July 30, 2023 @02:02PM (#36934080)
> Yes, when things change complexity has a cost.

Things always change. Software does not perform in a vacuum. It's subject to the inexorable progression of hardware decay and business knowledge loss, at the very least.

Re:Repeating Yourself Thrice Doesn’t Turn You into a 3x Deve... by PNWChris on Sunday July 30, 2023 @01:12PM (#36933414)
I'm of two minds on this, I both agree and disagree.

Once a code base is a certain size, explicit but bigger can be a boon. Magic dynamic dispatch systems and other tools that simplify plumbing make onboarding and routine, drive-by maintenance way harder IME.

I find that once you understand systems that have a dash of "magic", though, it is easier to add features and stuff. Single points of maintenance and all that.

It's a continuum, with each side having different benefits.

Re:Repeating Yourself Thrice Doesn’t Turn You into a 3x Deve... by praptak on Sunday July 30, 2023 @01:18PM (#36933515)
Debugging is easier when you have a backend server which logs the API calls.

I did debug apps where UI and DB access lived in a single code space (VB/Delphi style). This was pretty hard to debug and logic was so tightly coupled with the UI code that it was nearly impossible to write tests for it.

Re:Repeating Yourself Thrice Doesn’t Turn You into a 3x Deve... by FpUser on Sunday July 30, 2023 @01:37PM (#36933765)
Because those Delphi apps were written by less capable people. I've done tons of Delphi's applications in the past and still do some now (both Delphi and Lazarus). In every case the UI and backend business logic was clearly separated.
Re:Repeating Yourself Thrice Doesn’t Turn You into a 3x Deve... by lawn on Sunday July 30, 2023 @01:17PM (#36933502)
Extending and debugging complex code (eg autogenerating tools, macros etc) is much more difficult than simple code, even if the before can be written in fewer lines than replicating (nearly) identical but simple code.
Re:Repeating Yourself Thrice Doesn’t Turn You into a 3x Deve... by mawadev on Sunday July 30, 2023 @01:13PM (#36933432)
That is true, add more developers :)