dimanche 14 janvier 2018

Understanding design patterns practically

Suppose we are displaying a list which contains an imageview and textview as its item in which we are displaying data fetched from an api(web service).

In a simple manner I will create following classes-

Activity- which contains recyclerview and which will make a call to WebService class in our project passing request to it

WebService class- which is responsible for making api(web service) calls and returning response to the class which called it

Adapter -which contains handling of an item of recyclerview and displaying data from list which is passed in its constructor

Model(pojo class)- which contains get and set methods for the variables which we are getting as keys in json response from api(web service)

xml files- An xml file containing recyclerview and another xml file containing imageview and textview as an item of recyclerview

Now I want to understand how will this be different in different design patterns

1.MVC

2.MVP

3.MVVM

Aucun commentaire:

Enregistrer un commentaire