Architecture is the art of drawing lines -- Uncle Bob Martin
“Architecture is the art of drawing lines”
— Robert Martin
I heard that from Uncle Bob’s “Architecture: The Lost Years (Ruby Midwest 2011)” talk.
This is the diagram that he uses in his talk:
Lots of lines!
Do you see those two black lines in there?
I will redraw it to emphasize the two black lines:
Those are the boundaries.
And all arrowed lines that cross those boundaries always points inwards — towards the most important part/s of the system.
The reason why they are pointing inwards is so that the most important part will not become slaves of the details, as what Uncle Bob calls them, — so that the most important part will not be affected by the changes that will be made outside its boundaries.
We can redraw the diagram that Uncle Bob uses in that talk to look like this:
We can see that all the arrowed lines that cross the boundaries still points inwards — towards the middle — towards what they call the Business Logic part of the diagram.
If we move the black line at the right side so that it will look like this…
Does that look like the traditional 3-Layers Architecture that we know about? — Where the Business Logic Layer, the one at the middle, is dependent on the Data Layer, the one at the right.
Look at the arrowed lines that cross the boundaries…
We can go from 3-Layers Architecture to Clean Architecture, and vice-versa, just by moving the lines!?
Of course, moving lines in real world projects is much harder than moving lines in diagrams
But they are doable! Right?
Update - September 9, 2017
While reading Clean Architecture from Safari Books Online, I found this:
“… I’ve done this in order to show that architectural boundaries exist everywhere. We, as architects, must be careful to recognize when they are needed. We also have to be aware that such boundaries, fully implemented, are expensive. On the other hand, we also have to recognize that when such boundaries are ignored, they are very expensive to add in later — even in the presence of comprehensive test-suites and refactoring discipline.”
— Uncle Bob Martin
So… moving the lines might be doable. But it will be hard.