My way to Clean Architecture

Stefan M.
2 min readOct 7, 2019

--

At the end of 2015 I had an assessment at a company were one of my task was to explain the architecture of the Android App I had to build. Back then — and I don't make a joke here — my slide about architecture was this:

Before I joined that company all my architecture experience was... hell, I don't had a clue about architecture. I simply put my code into Activities and Fragments and was (somehow) happy with it.

For some reasons this company hired me anyways.

In the first couple of months at this company I learned the Model-View-Presenter architecture. What we did was basically just move the business logic from our Activities/Fragments out to a new class named SomethingPresenter. Now our Activities/Fragments contain only code to handle UI related things. I still ask myself where and what the model really is, but nevermind.

Round about 2,5 years later I switched to another (nearly new) project together with a new colleague (he was only 2 weeks in the company I guess). He was directly complaining about the few lines of code which were already there and opened a pull request titled "Introduce Clean Architecture". The description contains — together with a few other information — a link to this blog post. The blog describes in detail how you should structure your code.

Boy, I can tell you today. This changed everything for me when I read/talk/hear something about software architecture.

Anyways. I read his mentioned blog carefully. I started to understand that the idea (Clean Architecture) is not an idea from this guy from the blog but from a for me well respected guy named Robert C. Martin. Why I value him so much? Cause I've read Clean Code (and wasn't aware that there are a bunch more Clean X books are around) which changed my code style dramatically back then as I read it the first time.

I was shocked at the time I learned this because I always thought:

"MVP is my architecture"

I couldn’t have been more wrong. Nothing against MVP here, I still use it. But obviously only in my presentation layer.

Nowadays I use (or at least try) Clean Architecture in all of my projects. Regardless of the programming language and type of software (Android App, CLI Tool, SaaS website etc.). And I must admit that even if I have to think outside the box sometimes it works really well.

--

--