3 ms·
One of the seminal books for me was Writing Solid Code[0], written about 25 years ago. It's quite dated, but has a lot of stuff that is still relevant. I reme
by ChrisMarshallNY 6y ago
One of the seminal books for me was Writing Solid Code[0], written about 25 years ago.
It's quite dated, but has a lot of stuff that is still relevant.
I remember that one of his sections was titled "FLEXIBILITY BREEDS BUGS".
Here's the first paragraph:
Another strategy you can use to prevent bugs is to strip unnecessary flexibility from your designs.
You've seen me use this principle throughout the book.
In Chapter 1, I used optional compiler warnings to disallow redundant and risky C language idioms.
In Chapter 2, I defined ASSERT as a statement to prevent the macro from being mistakenly used in expressions.
In Chapter 3, I used an assertion to catch NULL pointers passed to FreeMemory even though it's quite legal to call the free function with a NULL pointer.
From every chapter I could list examples in which I reduced flexibility in order to prevent bugs.
I like to put flexibility into my designs, but I've learned to be very careful about it, and usually test the unused code paths anyway.
[0] https://dl.acm.org/doi/book/10.5555/2502682 https://dl.acm.org/doi/book/10.5555/2502682
- hprotagonist 6y agobalancing YAGNI against pain hint yourself into a corner is a real fun challenge.
- hprotagonist 6y ago... against painting yourself into a corner ...
- ChrisMarshallNY 6y agoSpeech-to-text issue? I had to correct a text I sent to my friend, Eddie. StT called him "Annie."