If you’ve been writing code for a while, you’ve almost certainly run into the same problems over and over — how to manage shared state, how to instantiate objects cleanly, how to keep loosely-coupled components in sync. Design patterns exist precisely to solve these recurring headaches.
In a recent article on Medium, the author draws from the classic book Design Patterns: Elements of Reusable Object-Oriented Software to highlight three patterns that every developer, and especially Data Engineers, should have in their toolkit.
The first is the Singleton pattern, a Creational pattern that ensures only one instance of a class ever exists. The author illustrates this with a car-sharing app where you absolutely cannot have two users editing the same car object simultaneously.
The second is the Factory pattern, also Creational, which lets you create objects without hardcoding their exact class. It’s particularly elegant when you need to generate many similar but different outputs, think different report formats in a document management system.
The third is the Observer pattern, a Behavioural pattern that powers the publish-subscribe model behind the notifications on your phone. One subject, many listeners, all updated automatically when state changes.
Beyond the explanations, the author backs each pattern with real-world analogies and even links to personal GitHub projects where the patterns were applied in practice.