

Hopefully, then, we will try to refactor the better code into an even better one, with clean-like architecture. Today we will look at the MVP design pattern, and we will try to refactor a really bad code into a better one.

There are many design patterns and architectures, and you can’t say for one that it is the best. Architecture is a more general term of design pattern. Basically, they are both terms that define the organization of code, but the difference is the layer. In theory, there is a small difference between design patterns and architectures. After a ton of research and frustration, I realized that I can’t test anything until I learn some design patterns and/or architectures. I started to divide the code into methods, but it wasn’t helping at all. I created test classes for some fragment, started to type some test methods, thinking I will figure it out what to test easily, and when I had to type the name of the test method my mind froze. I started to understand it a little bit, so I decided to write a few unit tests in my existing (mess) projects. So, I got into testing, started to read everything about testing, especially unit testing. I was thinking like: Ok, I will learn unit testing, my code will be tested, and everything will be fine. So, I realized that it isn’t enough that I can do anything the PO wants, but I have to find the right way of doing it. And every story was a short one and the same: This is going to be the best project ever -> Ops, it got little messy -> Oooops, everything is a mess, there is no going back. At the beginning of my carrier, I was very lucky to start a few new projects at my company.
