#softwaredesign
Focuses on principles and practices for creating well-structured and maintainable software. Topics include design patterns, testable designs, strong typing, functional concepts and more.
2024
Barricade + choke point π‘οΈ
Two design patterns that I’ve found helpful when designing systems to deal with untrusted data.
As little as possible πͺΆ
I believe smaller solutions lead to faster completion and higher quality.
Algebraic data types π§©
·14 mins
Compose types and use them to represent complex data in a clean and type safe way.
Same level of abstraction βοΈ
To make something easy to understand, its parts should be at the same level of abstraction.
Abstractions as communication π£
Create abstractions to communicate intent to your fellow programmers.
There is no loop π₯
Learn to move from imperative
while
and for
loops to declarative collection functions like map
and filter
.
Constructors and creation methods ποΈ
Use creation methods when a constructor fails to fully capture the programmer’s intent.
Why write unit tests? π§ͺ
·18 mins
A deep dive into unit testing looking to answer why, how much, and what.
Testable code is reusable code β»οΈ
Testability and reusability goes hand in hand. When you test a function, you run the code in another context than it was built for.
Remove temporal dependencies β°
How to avoid “temporal dependencies” where things must be done in a certain order.
Kill two bugs with one type πͺ²
An example of how just a little typing can help avoid several real-world problems.
Functional foundations βοΈ
·23 mins
A selection of functional programming concepts that I feel are helpful to all developers.
2023
Death by a thousand inconsistencies π
When you make an exception from a rule, you make the whole system harder to learn.
Generative AI as arbiter of "least astonishment" π€
Almost by definition, a suggestion by an LLM represents the least surprising solution.
2014
Convert guard clauses to value objects
How replacing validation functions with types can make your code safer and more expressive.
2012
Moving logic and data together [example]
An example of how moving logic and data together can result in a better design.
Donβt test private methods
The need to test a private method often indicates a new class waiting to get out.
Extract the logic (whatβs left is glue)
To make code easier to understand and test, try to move complex logic away from code with many dependencies.
How unit testing changes your design
Most complexity should be in classes with few dependencies, and most dependencies should be in classes with little complexity.
How to unit test code calling a static method
Don’t try to test code which calls static methods, try to get rid of the static methods.