New to mobile app development

from the CommonsWare Community archives

At November 26, 2019, 2:28am, xkillertanker asked:

Right now I try to start getting on designing the class diagram as well on what methods needed to develop a simple food delivery app based on object oriented concept. However I am not familiar at all with how to code mobile app in a well build object oriented way. I am confused especially with the situation stated below:


In food delivery app, Customer class has a method named createOrder() so that Customer object able to make food order. The picture shows an example of food cart with food selected together with a “Place order” button.

If the button is used to create a new order, do I only require to create one createOrder method within the activity class of the food cart and remove createOrder method of the Customer class (Button click triggers createOrder() in food cart activity class, all code needed to create order is within createOrder() in the activity class)


the app needs both createOrder method in activity class of the food cart and Customer class

(Button click triggers createOrder() in food cart activity class, after that createOrder() in the activity class will call createOrder method in Customer class)

(all code needed to create order is within createOrder() of Customer class instead of activity class, createOrder() in activity class only contains a method call to Customer class createOrder() method)

At November 26, 2019, 11:42am, mmurphy replied:

From an Android standpoint, you can do whatever you want. Android neither knows nor cares about the details of how you implement this sort of business logic.

If I were writing this app, Customer would be a plain model object, without a createOrder() method. I would have the button trigger a createOrder() method in my ViewModel, which would then work with some repository to update my data stores (database, server, etc.) and update the UI to reflect this created order.

You are a new subscriber to the Warescription (thanks!). The tutorials in Exploring Android walk you through building an app from scratch, including taking an approach akin to what I describe above for organizing the code. You can read Exploring Android on the Warescription site or download the PDF, EPUB, or MOBI/Kindle format ebook to read offline.

(a quick note: I moved this question into the “Android Development” category, as you posted it in “CWAC” which is for something else)

At November 26, 2019, 2:04pm, xkillertanker replied:

If Customer class no longer having createOrder() method, would that still being object oriented as one of the main behavior of Customer class has been removed? I would like to build mobile app based on object oriented design

At November 27, 2019, 1:26pm, mmurphy replied:

AFAIK, the approach that you are describing went out of style 15-20 years ago.

At November 27, 2019, 3:24pm, xkillertanker replied:

As I am totally new to it, do you have any references or samples on recommended programming approach and practices for system design in mobile app?

At November 27, 2019, 10:05pm, mmurphy replied:

I am uncertain how you are defining the term “system design”.

You might wish to watch this video from 2019’s Google I|O conference, to see Google’s current thinking regarding app architecture. It covers Plaid and how Google reworked it to modern approaches.

At November 28, 2019, 1:57am, xkillertanker replied:

What i mean is the methods of defining the structure of mobile app. For example what are the necessary classes in mobile app, relationships between each object and how they should be linking to each other. As I am just at the starting point, I would like to know how to come up with those components first before proceed to coding and UI design.

At November 28, 2019, 1:44pm, mmurphy replied:

I would like to know how to come up with those components first before proceed to coding and UI design

If you are working on a project with a team, and you are a newcomer to mobile, I recommend that you let other team members create the system design.

If you are working on a solo project, and you are a newcomer to mobile, IMHO you should be starting with tiny projects where there really is no “system design”. In other words, focus on learning Android, not exploring some business domain. Once you understand how Android apps work, and you have a sense of Android app architecture, then worry about other aspects of the system design.

My focus here is on helping developers learn Android, and secondarily on helping developers understand elements of Android app architecture. I cannot advise you on the design of your model objects in general.