Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is difference between mvvm with clean architecture and mvvm without clean architecture in Android?

I'm learning about MVVM and Clean Architecture. Then I found some articles present about MVVM + Clean Architecture, but I still didn't get it about the difference between mvvm with clean architecture and mvvm without clean architecture. Any summary about these stuff? Thank you.

like image 456
Stefanus Anggara Avatar asked Oct 21 '19 10:10

Stefanus Anggara


People also ask

What is the difference between MVVM and clean architecture?

Advantages of Using Clean Architecture Your code is even more easily testable than with plain MVVM. Your code is further decoupled (the biggest advantage.) The package structure is even easier to navigate. The project is even easier to maintain.

What is clean architecture Android?

Clean architecture is a method of software development in which you should be able to identify what a program performs merely by looking at its source code. The programming language, hardware, and software libraries needed to achieve the program's goal should be rendered obsolete.

What is difference between MVP MVC MVVM in Android?

References — In MVC, the View doesn't have reference to the Controller while in MVP, the View has reference to the presenter and in MVVM, the View has reference to the View-Model. Entry Point — For MVC, the entry point to the application is the Controller whereas, for MVP and MVVM, the entry point is the View.

What is MVVM Architecture in Android?

Model — View — ViewModel (MVVM) is the industry-recognized software architecture pattern that overcomes all drawbacks of MVP and MVC design patterns. MVVM suggests separating the data presentation logic(Views or UI) from the core business logic part of the application.


3 Answers

Clean architecture aims to separate the layers. Business Layer, Data Layer and Presentation Layer will be separate applications. Therefore you will increase the reusability for each one of them. MVVM as design pattern should be implemented in the Presentation Layer. Presentation Layer will interact with Business Layer (or Domain Layer) and the Business Layer will use Data Layer for sharing data.

like image 148
Bojan Dinev Avatar answered Oct 16 '22 10:10

Bojan Dinev


MVVM is just part of the clean architecture in the presentation layer. It just a set of rules on how to display the data from UseCase.

One of the benefits of using clean architecture is we can change our design pattern in presentation layer without changing domain layer or use case.

So for example, if we're using let say MVI and then changing to MVVM, it can be done smoothly with ease.. :)

like image 15
faruk Avatar answered Oct 16 '22 08:10

faruk


MVVM is just a technique to manage the View layer of whatever architecture you're using.

Clean Architecture is a way of organizing communication between layers. They aren't mutually exclusive

The Layers of MVVM with Clean Architecture The code is divided into three separate layers:

  • Presentation Layer
  • Domain Layer
  • Data Layer

Presentation Layer
Is here, where the logic related with views and animations happens. It uses Model-View-ViewModel ( MVVM), but you can use any other pattern like MVC or MVP

like image 5
foroogh Varmazyar Avatar answered Oct 16 '22 09:10

foroogh Varmazyar