“Basic” Software Design Principles
Some notes about the book “Pragmatic Programming”
I opened my notebook, some reading notes jumped out to me. They were all about a book I read 2 years ago, “Pragmatic Programming”. I decide to move those notes here before I lose them.
I have been working in a big monolith codebase for many years. I deeply understand the pain of not following these “basic” design patterns below. As an EM now am I, promoting these principles in my teams is one of my most important jobs.
Orthogonality
Two or more things are orthogonal if changes in one do not affect any of the others. In a well-designed system, the database code will be orthogonal to the user interface: you can change the interface without affecting the database, and swap databases without changing the interface.
Decoupling
This happens all the time, changing one thing breaks multiple places in a system. That leads to another problem, no one dares to touch the existing code.
Reversible Code
Make any parts of the system removable and replaceable.
Transforming Programming
A few examples
- Event Driven
- State Machine
- Functional Programming
Inheritance Tax
Inheritance comes with convenience as well as tax
Assertive Programming
- Use Guards
- Fail Early
- Do not overuse “rescue” or ”catch”
DRY — Writing duplicated code could cause bugs
Happy New Year! Welcome to 2023!