Back
Development 27 Apr 2026 8 min

Boilerplate is not evil

DTOs, mappers, layers, and model separation seem unnecessary when the system is small. But as the project grows, boilerplate limits the area of changes, makes the code predictable, and speeds up the team's work

Boilerplate is not evil

First Conflict

You've probably heard: "Why so much code for a simple task?", "Why can't you just write it?", "This architecture of yours only complicates things." This is usually said when someone first encounters boilerplate: DTOs, mappers, layers, model separation. And I understand them. Because I had the same reaction.

The feeling of '3 times more code'

When I first started working with a stricter architecture, it was frustrating. You add one field and change several classes: DTO, mappers, and a couple more layers. And it feels like: "I'm writing 3 times more code for the same task." And in the short term, that's true.

Friction from extra structure and repeated code

Why Active Record/Eloquent Seems More Convenient

Especially if you have previously worked with, for example, Active Record, where the model equals everything, logic is right inside, data, validation, behavior — all in one place. You just write and everything works, quickly, conveniently, without any extra hassle. The problem doesn't start immediately. It begins when the system grows.

How Chaos Grows

Typical scenario. First, one model, a bit of logic, everything is clear. Then observers are added, events are added, checks are added, business logic starts to spread out. And at some point, you no longer understand where everything is happening.

The most painful thing is change

The most painful moment is changes. For example, you had one data source (a local database). Then an external API or another type of storage appeared, or you need to change the way you retrieve data. And suddenly you need to change everything: controllers, models, business logic. Because everything is directly connected.

Why is boilerplate needed

And this is where it becomes clear why boilerplate is needed. When you have a structure, the domain is separated, the infrastructure is isolated, there are models for each layer, and there is mapping, changing the data source does not break the system. You only change the infrastructure layer. The rest remains untouched. And this is the key idea, boilerplate is not about "writing more code," boilerplate is about "limiting the area of changes".

Structure limits the blast radius and cost of change
Structure exists not for beauty, but so that changing one part does not break the whole system.

Abstraction is a shift of focus

Now about the level of abstraction. Many perceive it as "complication." In practice, it's just a different level of work. You stop thinking "how to save to the database," and start thinking "what is an entity," "what are its rules," "how should the system behave". Infrastructure takes a back seat, and system behavior comes to the forefront. Yes, the price for this is additional code. But this is code that makes the system predictable, simplifies changes, and reduces the number of errors in the long run.

Team and Predictability

Boilerplate is especially important in a team. Because repeatability = predictability. When the structure is the same, a new developer integrates faster, it's easier to read the code, and it's easier to do reviews. They don't think "how is everything arranged here," they already know it. And this is where a shift in thinking occurs. At first, you think "why so much template code," then you realize "it's good that it's the same everywhere." Yes, boilerplate can be partially automated through code generation, templates, and AI. And that's normal. Because its goal is to fix the structure.

Output: fast now or stable later

And finally. Architecture is not about complication. It's about control. If you have a small project, yes, you can keep it simple. But as soon as the system starts to grow, chaos becomes more expensive than extra code. In short, without structure, you're faster at the start. With structure, you're faster in the long run. And the choice is always the same, fast now or stable later. Boilerplate is the price for stability. And if you accept this, you start writing code that lasts longer than a single feature.

development routine

More on this topic

Latest published materials from the same category or adjacent topics.

Learning to Befriend Someone Else's Code
Development 27 Apr 2026

Learning to Befriend Someone Else's Code

Reading someone else's code for the first time is almost always stressful. But there is an algorithm that removes the chaos and provides an entry point

Read
Numbers Never Lie
Development 27 Apr 2026

Numbers Never Lie

How metrics changed my approach to optimization. A real case: from 'something is slow' to a 2-3 times increase in conversion through specific data

Read
Microservices — One of the Most Expensive Mistakes at the Start
Development 27 Apr 2026

Microservices — One of the Most Expensive Mistakes at the Start

Why microservices are not the default architecture, but a tool for a specific problem. Two real cases: when it was a mistake and when it was justified

Read