Android Food Cart




Multithreading to synchronize orders of all customers

Model-View-Controller design pattern for creating different customer activities
Created SQL database and queried customer and food information
Firebase database
Profit and taxes
UI for client/ consumers
UI for server/ chef



Demonstrating video:




Demonstrating video for Asynchronous communication:




UML diagram:







Sequence diagram:




MVC design pattern



Flexible designs - client and server interface

  1. The layout is made completely flexible with the changing customer and Chefs demands.
  2. To keep the app updated with changing technologies, an adapter is introduced which will add the new versions and update the firebase database in real time.
  3. The options for client and server are different according to their needs.

Asynchronous and synchronous :
  1. There are two types of threads: main thread and background thread.
  2. The main thread is the UI thread which handles the user interface objects
  3. The background thread is the worker thread which can be used to perform any tas in the background.
  4. Only main thread can touch the UI
  5. Android doesn’t allow us to do network calls on UI thread.
  6. Also, it doesn’t allow to make any changes to the UI while using the background thread.
  7. The AsyncTask is useful for overcoming this problem.
  8. It works in the background thread and publishes the result in the UI thread.
  9. DoInBackground() runs on background thread.
  10. OnPostExecute() runs on main thread.
  11. Inside the DoInBackground(), we perform the reading from the UI like the number of items name, ID, etc.
  12. We also perform writing to the socket, like the complete order details which need to be sent to the server.
  13. Inside OnPostExecute(), we send the reply message to be sent to the server.

Multithreading:
  1. Each client acts as a single thread.
  2. Whenever the client's order is received at the server, the server starts processing the order one by one.
  3. For the smooth functioning of processing, we create a synchronization task which will sleep the thread as an action of processing the order.
  4. When the thread is done sleeping, it will notify the next thread by calling the method notify().
  5. When the next thread/ client gets invoked, it enters the synchronization block and starts processing the order (sleeps).
  6. Thus the android app performs multithreading
Performance awareness:
  1. As we are using the Google’s Firebase database to store and retrieve information on food items, their price, as well as Users sign up information, the performance of the application is highly enhanced.
  2. The information of the application is stored in a .json format, which ensures the security of the information, the reliability of communication, as JSON files are not easily corrupted.
  3. The data is stored in .db file in the application, thus querying the data becomes convenient.
  4. When both chef and users use the same application, the space occupied by the app increases, however, the cost of the application is reduced.

Comments

Popular Posts