Earlier quoted context omitted.
Sure, but when applying "simple is robust" principle it is extremely important to understand also intrinsic complexity. Not handling edge-cases etc does not make for robust code, no matter how much simpler it is.
Yes, but I definitely also see the opposite quite a bit: Somebody several layers down thought that something was an edge case, resolved it in a strange way, and now you have a chain of stuff above it dealing with the edge case because the bottom layer took a wrong turn. The most common examples are empty collections: either disallowing them even though it would be possible to handle them, or making a strange choice l…
Write code that is easy to delete, not easy to extend (2016)
71–80 of 102 posts
Re: Write code that is easy to delete, not easy to extend (2016)
#72it's crazy how we keep going through all those injunctions (religions) about software, they all look amazing on paper, feel like common sense and yet 50 years in, software is garbage 90% of the time yet, we keep bringing this stuff up like it's some sort of genius insight / silver bullet
Re: Write code that is easy to delete, not easy to extend (2016)
#73I recently did our first semi-automated removal of exposed graphql resolvers, metrics about how often a given resolver was already available so parsing that yielded the set of resolvers I *couldn't* delete. Graphql already has a deprecated annotation, but our service didn't handle that annotation in any special way. I added observability to flag if any deprecated functions have been called & then let that run for sufficiently long in prod, then you can safely delete externally exposed code.
Re: Write code that is easy to delete, not easy to extend (2016)
#74My favorite saying: “simple is robust” Similar in spirit to Lehman’s Law of Continuing Change[0], the idea is that the less complexity a system has, the easier it is to change. Rather than plan for the future with extensible code, plan for the future with straightforward code. E.g. only abstract when the situation requires it, encourage simple duplication, use monoliths up front, scale vertically before horizontally,…
+1, but I'm not sure if the "simple is robust" saying is straightforward enough? It opens up to discussion about what "simple" means and how it applies to the system (which apparently is a complex enough question to warrant the attention of the brilliant Rich Hickey). Maybe "dumb is robust" or "straightforward is robust" capture the sentiment better?
As a biomedical engineer who primarily writes software, it’s fun to consider analogies with evolution.
Copy/pasting and tweaking boilerplate is like protein-coding DNA that was copied and mutated in our evolutionary history.
Dealing with messy edge cases at a higher level is like alternative splicing of mRNA.
Re: Write code that is easy to delete, not easy to extend (2016)
#75it's crazy how we keep going through all those injunctions (religions) about software, they all look amazing on paper, feel like common sense and yet 50 years in, software is garbage 90% of the time yet, we keep bringing this stuff up like it's some sort of genius insight / silver bullet
I think it's because 90% of the garbage is being written by people that don't read or write articles like this one.
the problems in engineering rarely stem from the lack of principles and have way more to do with mismanaged projects, arbitrary deadlines, shifting priorities, unreliable sources of data, misunderstood business logic and all those fancy acronyms, all the SCRUM and agile in the world will never make up for all that
Re: Write code that is easy to delete, not easy to extend (2016)
#76My favorite saying: “simple is robust” Similar in spirit to Lehman’s Law of Continuing Change[0], the idea is that the less complexity a system has, the easier it is to change. Rather than plan for the future with extensible code, plan for the future with straightforward code. E.g. only abstract when the situation requires it, encourage simple duplication, use monoliths up front, scale vertically before horizontally,…
> encourage simple duplication A rule I like to follow: - first time: write it - second time: copy it - third time: maybe refactor it
Re: Write code that is easy to delete, not easy to extend (2016)
#77Earlier quoted context omitted.
Because building for extensibility adds real complexity for a hypotetical need If you want the code to do something different later, change, replace or extend it then... when you actually know what it needs to do
I am not sure that is something that applies 100%, but I understand the concern. It is my understanding that we should try to build solutions to current problems, and be open to future use cases that could involve small additions in functionality. It would be stupid to design an unmodifiable system just because some parts can be deleted and we are not sure what future needs are. Code should always be easy to extend,…
Re: Write code that is easy to delete, not easy to extend (2016)
#78Earlier quoted context omitted.
I think it's because 90% of the garbage is being written by people that don't read or write articles like this one.
I don't think it's the case, because all those schools of thought (your DRY, your SOLID, your DDD, etc) all have opposite schools of thought rife with other similarly popular mantras the problems in engineering rarely stem from the lack of principles and have way more to do with mismanaged projects, arbitrary deadlines, shifting priorities, unreliable sources of data, misunderstood business logic and all those fancy…
For example, abstracting every piece of similar code to make it "DRY" because they don't understand that it's about concepts not code.
Re: Write code that is easy to delete, not easy to extend (2016)
#79 > To write code that’s easy to delete: repeat yourself to avoid creating dependencies, but don’t repeat yourself to manage them. Layer your code too: build simple-to-use APIs out of simpler-to-implement but clumsy-to-use parts. Split your code: isolate the hard-to-write and the likely-to-change parts from the rest of the code, and each other. Don’t hard code every choice, and maybe allow changing a few at runtime.
My experience is that the title doesn't hold. Code that is easy to delete is -- more often than not -- also easy to extend because it is layered, modular, and isolates different pieces through abstractions like interfaces or other type contracts.Re: Write code that is easy to delete, not easy to extend (2016)
#80My favorite saying: “simple is robust” Similar in spirit to Lehman’s Law of Continuing Change[0], the idea is that the less complexity a system has, the easier it is to change. Rather than plan for the future with extensible code, plan for the future with straightforward code. E.g. only abstract when the situation requires it, encourage simple duplication, use monoliths up front, scale vertically before horizontally,…
> encourage simple duplication A rule I like to follow: - first time: write it - second time: copy it - third time: maybe refactor it