Principles I Believe In
After years of building software, I’ve noticed the same patterns coming up again and again. Over time, I’ve turned those into a handful of design principles I try to stick to.
Principle 1: Keep Related Code Together#
A lot of Node.js/Express projects split things by type. You’ll see controllers in one folder, services in another, models somewhere else. On the surface it looks neat and tidy, but in practice it scatters a single feature across half the codebase. Whenever you want to add or change something, you end up jumping between directories just to piece it all together.
It’s usually easier if everything a feature needs lives side by side: the controller, service, tests. This applies to frontends too. React components, hooks, and styles should live together as a feature slice . That way, when you’re working on a feature, you only need to look in one place. The project structure naturally follows the way the software grows.
(I’ll add more as I revisit this.)