News for hackers. Stuff that matters.
Re:Code Lifespan by gopalv on Friday January 27, 2023 @04:12PM (#34551926)
> Points (1) & (2) really contradicts the generalized solution approach

So I was told this as bluntly as possible by someone 15 years ago - "you don't have to code all parts of your design".

Every line of code you write makes it harder to replace it. That the feature is an asset, the code is a liability. That the goal they had set out for me was to write as little as possible, but achieve the same result.

The only reason to rewrite a system out of tech debt, which is what I was doing then & getting lost in a sort of second system "this is the last rewrite" effort, is to write the next feature with less code - even if the next system needs you to rewrite bits you just wrote.

This might sound simplistic, but I've seen that work over and over again.

Plus, it was much easier to hand over the code to the next person when I wanted to do something new and interesting, if it was functionally complete and not full of half designed extension points all over.

Re:Code Lifespan by knlb2022 on Friday January 27, 2023 @04:52PM (#34552397)
> "you don't have to code all parts of your design".

That's an excellent articulation of what I think as "invisible seams" when I write code: they're soft points of extensions that don't need a separate interface/function/class _yet_. Sometimes I just mark them for myself with an extra newline within a function.

Re:Code Lifespan by einpoklum on Friday January 27, 2023 @06:37PM (#34553306)
> So I was told this as bluntly as possible by someone 15 years ago - "you don't have to code all parts of your design".

I would say that's more false then true.

Why? Because the design you haven't coded is a fantasy design. I'll give you a counter-quite, and excuse the military context: "No plan survives contact with the enemy" (simplification of a longer quote by Helmuth von Moltke.)

I have yet to make any non-trivial design which does not require significant changes while it is being coded. Perhaps some design geniuses with much deeper insight can make this happen - but those are very few. Most people probably need several rounds of implementation and user interaction before reaching an acceptable design.

So those parts of your design which you haven't coded are likely partially irrelevant and un-implementable.

This is not to say that you should write huge amounts of code. But - try to avoid designing much beyond what you actually code.

Re:Code Lifespan by chrisweekly on Friday January 27, 2023 @08:22PM (#34554104)
I think it's important to keep in mind that there are many different types of "design": requirements design, interaction design, architecture design, code design... which inter-relate and are often worked on in parallel.
Re:Code Lifespan by nicoburns on Friday January 27, 2023 @08:23PM (#34554109)
You shouldn’t code all of your design precisely because “no plan survives contact with the enemy”. The bits you’ve designed but haven’t coded yet are much easier to change in response to future requirements.