Richard Clayton
Writing Better Apps: Dependency Injection
Dependency Injection (DI) is a pattern where the "things" a component (function, class) depend on are passed into the component instead of the component trying to instantiate (or resolve it) itself. This practice tends to make code a lot more robust by reducing a component's scope. The DI pattern also simplifies the testing . . .
Posted in: craftsmanshipnodejstypescript
Algorithm: Winner in Tic-Tac-Toe
In Rust!
There was a thread on Reddit that caught my interest the other day. A Software Engineer at Google mentioned his favorite interview question for potential candidates was to have them write an algorithm to determine if a tic-tac-toe game had a winner. Thinking about the question inspired me to solve the algorithm.
To make the task more . . .
Unified Observability
Thinking about the future of logging, metrics, and tracing in applications.
The last decade has seen exciting developments in runtime observability of services. Log aggregation and search are a requirement for operationalizing systems. Organizations are collecting real-time metrics from production systems and using that data to get insight into customer behavior. Most importantly, distributed tracing is becoming . . .
You can't just be a backend developer.
(most of the time)
Last week I came across Asko's blog post on Reddit (r/programming) about why he doesn't want to work in the front end anymore. I had similar feelings three years ago after working as a full stack developer and insisted on taking a pure backend role with my current employer. Ignoring the frontend turned out to be a colossal mistake and . . .
Writing Better Apps: Implementing Configuration
"Configuration" is the settings your application uses to change its behavior at runtime. Configuration might include simple values that adjust timeouts on requests to more complicated settings that swap out database or cloud service providers.
The process of collecting and validating configuration is critical to a stable . . .
Posted in: craftsmanshipnodejstypescript
Writing Better Apps: Initialization
Whether you are writing a script, a multicommand CLI utility, or a networked server, applications should follow the same initialization pattern:
- Get configuration
- Build dependencies
- Resolve and execute the entry-point function
Get configuration
Using the environment, and possibly command line . . .
Posted in: nodejstypescript
Templatizing Github "Template Repos"
Adding the (obvious) missing feature to Github Template Repositories
tl;dr
Get better use out of Github Template Repositories by introducing your own templating mechanism. Using a combination of gomplate, tree
, and bash
can get you there pretty easily. This article demonstrates an example of how it's done.
Last year, Github added a new feature called Template Repositories. . . .