skip to Main Content

I want to develop a real-time chat application in Android like WhatsApp or telegram
for the all-purpose client should connect to the server via WebSockets and even
offline or online has to works fine. I decided to use Android architecture like MVP, MVVM, and MVI, but I’m confusing which one is suitable for my app

Can anyone help me to choose one of them?

And my second question: is it ok to use WebSockets for all APIs or it should better use WebSockets and REST APIs together?

Thanks for your help

2

Answers


  1. There are quite a few patterns out there for app architectures. The most well known are the classic three-tier architectures such as:

    1. MVC: Model-View-Controller.
    2. MVP: Model-View-Presenter.
    3. MVVM: Model-View-ViewModel.

    All these patterns represent the main similar idea — to structure your project’s code in a way that it is separated by the different generic layers. Every layer has its own responsibility. That’s why your project becomes modular: separated code parts are more testable, and your app is flexible enough for continuous changes.

    MVP is strongly recommended because a lot of developers are using it now. Even, Google also provides its best practice example on Github. You can see full document here.

    Login or Signup to reply.
  2. I strongly recommend you use MVVM because Google has adopted this approach for Android Projects recently. You can find a lot of examples about it. Especially LiveData and ViewModel mechanisms have a lot of advantages in terms of separation of concerns and managing the relations between ui and data.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search