{"id":468,"date":"2019-08-03T13:02:30","date_gmt":"2019-08-03T12:02:30","guid":{"rendered":"http:\/\/toptechytips.com\/?p=468"},"modified":"2020-06-03T12:07:48","modified_gmt":"2020-06-03T12:07:48","slug":"lets-deep-dive-into-android-project-architecture","status":"publish","type":"post","link":"https:\/\/dotslaz.com\/lets-deep-dive-into-android-project-architecture\/","title":{"rendered":"Let\u2019s Deep Dive into Android Project Architecture"},"content":{"rendered":"

Let\u2019s Deep Dive into Android Project Architecture
\nHello World!<\/strong>
\nWhen I started coding with Microsoft Visual Basic, from then my only intention was to make things work. I think for most of the programmers, this happens at an early stage of their carrier. But when we get the chance to write our first line of code that I am actually paid for, after that very soon we can realize that we also have to care about our codes.<\/p>\n

Cause people are using what we are developing, and users want more features, and your client pushes you to add features or change features. We also know that the one and only constant in software development is \u201cCHANGE<\/strong>\u201d. That\u2019s where you are late to join the party, that we are already taking advantage of.
\nI know you have a question in mind, If my application runs well without any error, then why are you pushing me to those complex and messy things?<\/p>\n

Why you follow Android Project Architecture?<\/h3>\n

Yes! You are right, you can develop applications without following any architecture, and even you can make the application bug free as well without the following architecture. Then why?
\nI did appreciate your question, just a few months away from now, but now I can realize why \u201cUncle Bob\u201d wrote a whole book on clean coding and architecture. The one and the only answer are to make your code \u201cReusable, Readable, Testable\u201d and believe me you will give me Thanks when you deep diving into it really! And it\u2019s more than worth it to start diving into it.
\nI should tell you that, you will get tons of articles over the internet about how to use MVP, MVVM, MVC without even knowing why to use?
\nThat\u2019s why at first I tried to answer some of them!<\/p>\n

So let\u2019s start the journey!<\/h2>\n

When we started with Android most of us only know about Activity, Fragment is default classes provided by Android to write codes. And we only write some other classes like Adapters and other things. But only care about the Activities and Fragments. Where we do all the things like any UI stuff, network calls to get data from a server and even make a query into the local database to get data and then bind that with the UI.
\nAnd when your project gets bigger and bigger, you see lots of Fragments and Activity full of codes, sometimes 1000 thousand lines and above. And you start to think of yourself a great programmer as you have already written this much codes, and it\u2019s working and going in production and also people already started using it.
\nBut when you open the project after 1 month or 2 months you will deep dive into the \u201cMariana Trench<\/strong>\u201d the deepest point on the sea known by until now.<\/p>\n

Which is the best Android Project Architecture? MVP, MVVM, MVC, Clean Architecture?<\/h3>\n

When I started writing this article, I was fearing this question of you, I did know that you will throw this to me. But I thought I have an answer for you.<\/p>\n

MVC (Model View Controller):<\/h3>\n

This pattern was the only thing for the mobile and web developer when they just need to separate the business logic from the UI and also where business logic doesn\u2019t need to change much like the UI<\/p>\n