Part 4 of the Angular in Production series

One thing I've noticed after working on larger Angular applications is that components rarely becomes difficult to maintain overnight, it hapens gradually. When you add a feature and another, and new modals, new API calls and new permission checks. Nobody deliberately decides to create a thousand-line component. It simply happens because adding a little more logic always feels easier than creating another abstraction. At first, it doesn't seem like a problem and the application still works. But eventually you open the file and realize you're no longer looking at a UI component. You're looking at an entire feature packend into a single class. That's usually the point where every new change starts taking longer than it should.

Component Size Is a Symptom, Not the Problem

One mistake I used to make was measuring components by their number of lines. A component with 800 lines isn't automatically bad. Likewise, a component with 150 lines isn't automatically good. What matters is responsibility. I've seen relatively small components responsible for:

loading data