jeudi 24 août 2017

Design pattern in RESTful Android applicaton

In my app, which has tabbled activity with four tabs [ tab1 | tab2 | tab3 | tab4 ]. Pic shown is not of my app, but to get a feel how it might look similar to although there are differences as mentioned here.

enter image description here

  1. Each tab is associated with a fragment. Each fragment is list, either in vertical list or grid.
  2. Tab1 and Tab2 has list of similar objects(X), restaurants.
  3. Tab3 has different class object list (Y), friends.
  4. Tab4 has object list and each object is superset of object(X) + object (Y). Restaurants and my friends who visited there.
  5. Each of these tab content are different and obtained through RESTful http call.

Now, my query is:

  1. Should I put all view class, X, Y, X+Y in factory pattern?
  2. Should I put REST api call into observer pattern with callback on data receive?

Am I correct with this approach or should I chose different pattern to make things even improved?

Aucun commentaire:

Enregistrer un commentaire