3 ms·
It applies to all layers of software engineering as well. Yesterday I was writing an XML parser (on top of Go's std lib), but I needed to read the first line of
by Cthulhu_ 5y ago
It applies to all layers of software engineering as well. Yesterday I was writing an XML parser (on top of Go's std lib), but I needed to read the first line of the XML file to determine if it was UTF-8 or ISO encoded.
I added code and lines to handle edge cases - what if the XML prolog is not on the first line? What if it starts with whitespace?
But these are all edge cases that are unlikely to happen, and if they do... just let my application crash or error, it's not worth adding code until it's actually needed.
Same with performance, I'm thinking "I should add caching", but I don't even know how efficient my application is if it has to read & parse the files for every request - I'm assuming fast enough, until proven otherwise.
- noduerme 5y agoMy grandfather invested in a new apartment building back in the 50s. At the end of every day he'd go there with a case of beer for the construction workers. He said, "I want to make sure they care. So if they see a place where one nail is enough, they'll hammer in two nails just to be sure." That's how I feel for my clients; I hammer in all the nails I can think of. The result is, usually I'm shocked by how few bugs there are in production. I've had business software running 24/7 that goes for years without any intervention. The occasional upgrade or minor UI fix. Error-proofing is the state of mind you're in when you write that parser and google for every edge case you can think of. [edit] I just want to add another thought. There's such a thing as needing to ship. If you add every bell and whistle, every speed improvement and cache, you'll just keep going and never finish. The important thing is to think about these possibilities as you're writing the code, and document them so you know where the pain points might be if this software is still running much more intensively ten years down the road.
- Sammi 5y agoGreat story. I think it is about a different problem that what the post is about though. The post is about yagni and not adding unneeded configuration and complexity, and having an opinionated design instead. I think you story is more about solving the actual real problem for the end user well.
- noduerme 5y agoHm. Thank you. And good point. Designing for other coders to work with your code is very different than designing for only a client, and your future self. Too many options or unnecessary hooks in an API is a pain when you just want to do something clear with it. Not enough options can render a platform unsuitable. In some ways this is a classic problem - if you run a shoe store, do you put out one beautiful shoe that everyone tries to fit into, or too many shoes to choose from. But in software, the feet change shape. So the more opinionated something is, the more it runs up against an unforeseen future (I'm thinking about Actionscript, JQuery, D3...) Maybe a good balance would be to design an opinion into the software, but with alternate futures in mind, to try to foresee breaking changes... this can be opinionated, but still leave options open in case requirements change..? But yes, it's harder if you're building an ecosystem. TL;DR I still think writing more options is better as a rigorous thought process, if not as actual code. If you must, hide them from the API consumer, but have them in the arsenal. (In itself, that's an opinion).
- marcosdumay 5y agoWhy spend 3 minutes making your code correct when you can just spend a day or two understanding and debugging user bug reports? (That is, if you have only a few users.)