Blog
Mar 25, 2025
5 Min. Read
How To Do Dependency Injection In Rust With Static Dispatching
Dependency injection (DI) is a common design pattern that tech companies use to increase the flexibility, maintainability, and testability of their software. Long-standing, industry-standard languages such as Java have a number of frameworks solely for this purpose, such as Spring, Guice, and Dagger.
However, in Rust, dependency injection is not an easy pattern to implement, at least not in a "Rust-like" way. Most, if not all, libraries and examples achieve DI through dynamic dispatching (trait objects). They also typically do not offer a solution for, in my opinion, one of the best features of DI frameworks - the ability to configure environment-specific dependencies at compile time (i.e. production dependencies for prod environments, beta dependencies for beta environments).
Mar 07, 2025
10 Min. Read
Good Software Engineers Write Code That Minimizes Cognitive Load
It's not enough to write code that works. An important role in software engineering is to write code that is easily maintainable. And code cannot be easy to maintain if it is not also easy to read. One of the ways good software engineers do this is by paying attention to how much cognitive load their code induces on its readers.