There are a number of architecture rules that may help us understand how to deal with the previous undesirable situation.
Architecture rules of thumb
The separation of concerns
The renowned Dutch computer scientist, Edsger Dijkstra, first mentioned his idea of how to organize thought efficiently in his paper from 1974, On the role of scientific thought.
He called this idea the separation of concerns. To this date, it is arguably the single most important rule in software design. There are many other well-known rules, but many of them follow from the idea of the separation of concerns. The fundamental principle is simply that we should consider different aspects of a system separately.