News for hackers. Stuff that matters.
Re:Good code is like a love letter to the next developer who... by The_Colonel on Friday July 21, 2023 @07:22AM (#36812505)
I agree wholeheartedly. Code which is "designed to be extensible towards future use cases" very often expects the wrong kinds of extensions and actually makes it more difficult to extend it because it's necessarily more complicated.

> Most of the time, code that is easiest to modify or reuse is the code that does its current job in the simplest way possible.

Very much this.

Re:Good code is like a love letter to the next developer who... by K0balt on Friday July 21, 2023 @09:32AM (#36813553)
The exception here I think is the choice of data structure. If you know that code will be extended to accept additional fields it makes sense to be sure to use an extensible data structure or to ensure that side effects are contained correctly (a good idea anyway) and in a way that allows extensibility when they must be changed.
Re:Good code is like a love letter to the next developer who... by The_Colonel on Friday July 21, 2023 @06:30PM (#36820836)
> If you know that code will be extended to accept additional fields

Well, you rarely know, more often "guess".

There's an important distinction between public and private interfaces. With public interfaces, I contend that it does make sense to think about future use cases and put in some flexibility even at the cost of a small overhead.

Re:Good code is like a love letter to the next developer who... by K0balt on Saturday July 22, 2023 @09:34PM (#36831761)
That seems reasonable.