Skip to content

Commit 7c106c7

Browse files
authored
Update README.md
1 parent 9db260a commit 7c106c7

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

README.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,12 @@ MVVM involves a data binding approach to make code short and reduce view handlin
3131
## Choice of correct architect
3232
:eyes:
3333
<br>
34-
**Choice of a correct architecture** for the project involves the understanding of the modules which needs to be developed. Some functionalities works great on MVC, some with Mvp and some with Mvvm. It is quite difficult to debug projects made on MVVM due to data binding and live datas. An application which recieves continous data from a source, needs a regular UI - update and has majorly(80-90%) one sided communication like solar-cell, inverters, or any device's status monitoring can work well with MVVM due to **live data** - UI update. Debuging can be easy in such applications as **major flow of data is one sided**.
34+
**Choice of a correct architecture** for the project involves the understanding of the modules which needs to be developed. Some functionalities works great on MVC, some with Mvp and some with Mvvm. It is quite difficult to debug projects made on MVVM which doesn't have one sided data flow due to data binding and live data. If an application receives continuous data from a source, needs a regular UI update and has majorly(8090%) one sided communication(eg: sending logs from electronic devices to android app) like solar-cell, inverters, or any device's status monitoring can work well with MVVM due to **live data** - UI update. Debugging these MVVM applications can be easy as **major flow of data is one sided**.
3535

36-
MVP is a good approach in writing android projects when we are concerned about testing the bussiness logic w.r.t unit testing via JAVA test frameworks(Not Android frameworks). Since **JAVA test framework** will only resolve java dependencies and a clean presenter layer is free from android related dependencies like context, sharedpreferences, or any other **com.android.*** package. Drawback of MVP is that it ends up writting **20-25% extra code** with the same functionality written in MVC. Mvp is good if you are really interested in test cases and unit testing of modules.
36+
MVP is a good approach for writing android projects when we are concerned about testing the bussiness logic w.r.t unit testing via JAVA test frameworks(Not Android). Since **JAVA test framework** will only resolve java dependencies and a clean presenter layer is free from android related dependencies like context, sharedpreferences, or any other **com.android.*** package. Drawback of MVP is that it ends up writting **20-25% extra code** with the same functionality written in MVC or MVVM. Mvp is good if you are really interested in test cases and unit testing of modules.
37+
For MVP using java test kits just make instance of presenter and run test functions.
38+
<br> <br>
39+
eg: **new Presenter().testSomeFunction()**.
3740

3841
Mvc is widely used technique in android. Google itself wrote it's repositories in MVC for many years. Now a days google is following MVVM for it's github repositories as these repo's are small and majorly samples. MVC application can be tested via android test frameworks not with JAVA specific test tools due to lack of dependencies of **com.android.*** **packages** in java specific tool.
3942

@@ -42,6 +45,8 @@ Mvc is widely used technique in android. Google itself wrote it's repositories i
4245
2. A luminous inverter monitoring application can work best with MVVM due to major one sided data flow.
4346
3. E-commerce application can be build in MVC, MVP but MVVM may make some modules very complex.
4447

48+
**NOTE**: There is no single architecture which is best of all. If there was one, there wouldn't be any need of learning other architectures. Choice of correct architecture depends on several factors like initial requirements, data flow, scalability, maintenance, updates(CRs), testing requirements.
49+
4550
Except these three android architectures, there is one more architecture named as **"MVI** - Model view Intent". This is not very popular among Android developers. Please check this link if you are interested in **MVI**.
4651
<br>https://github.com/saksham24/Android-simple-MVI-pattern-with-MVP-MVVM-collaboration
4752
<br><br><br>

0 commit comments

Comments
 (0)