mudit
mudit

Reputation: 25534

Need to design the architecture design of an android application

I need to create an architecture design for my application.

App Details: In my app, i show some data which is fetched from server. So basically when you start the app, you get a list of categories and when you click on a category, application calls a web service using REST and get a JSON response. After getting the response, JSON data is parsed to create an Arraylist of objects and finally an adapter shows this data in a list view.

Package structure which i have thought of:

com.app.activities: contains all the activities required in the application.

com.app.customviews: custom views required for the application.

com.app.adapters: different list/grid adapters to create different types of list and grid views.

com.app.parsers: contains all parser classes to parse the JSON response received from the server. These classes basically will return an arraylist to the activities which will be further used by adapter class for creating list and grid views.

com.app.utils: contains functions which are used through out the application like function for getting the response from server for a request, getting a string from the inputstream, download an image from a certain url, logging etc.

com.app.model: contains all the model classes for various user-defined data types.

App work flow: When a certain category is selected, activity gets the response from utils and send it to parsers to get an arraylist of Model type. Now this arraylist is passed to the adapters which returns an adapter object which is finally used in showing the list/grid in the activity.

Now as per the application architecture, your code should be divided into following three layers:

  1. Presentation Layer
  2. Business Layer
  3. Data Layer

Now i need to know, as per my application which part belong to which layer.

Please help, i am totally clueless about this.

thanks!!

Update: While googling i stumbled upon this link:

http://apparchguide.codeplex.com/wikipage?title=Chapter%2019%20-%20Mobile%20Applications

It says, your application should have some workflows, business components, entities etc.

So, i think my current package structure is incorrect as i am doing most of thing in Activities only.

So now, my question is: If i follow this architecture, what should be package structure or how do i setup my code base.

Upvotes: 5

Views: 2904

Answers (2)

mayank_droid
mayank_droid

Reputation: 1015

your UI of application is, you can say it presentation layer. In business layer you do operations with REST and JSON web service. And the data layer resides on server. So basically you display the listview(Presentation) by using some services(Business) to get result(information) from server(Data).

Upvotes: 0

slipbull
slipbull

Reputation: 1497

Is your app is only dedicated to presentation? The business layer is implemented in the server, since you do not change data, only show it. For me model is in the data layer, all the rest is presentation.

Upvotes: 0

Related Questions