What are the Techniques for Composing Applications in android

In Android, there are so many techniques that are used to build an application. And in this article, we are going to learn the BEST Techniques for composing applications in android that are commonly used in GUI environments. We follow many approaches; every developer or company has its thinking and techniques to build an application but three are the most popular ones that are used by 90% of the developers. Each technique has its advantages and disadvantages. Developers choose techniques according to their needs.

What are the Techniques for Composing Applications in android

As the name suggests, these are the techniques that a developer or company should follow to build an application in android.

Types of Techniques for composing applications in android

Composing application techniques include the MVC (Model View Controller) model, Event based programming, and the use of auxiliary files.

There are Mainly Three types of techniques for composing applications.

types composing application
  1. MVC (Model View Controller) Model.
  2. Event-Based Programming.
  3. Auxiliary Files.

Now let’s deep dive into these techniques & elaborate in detail.

Event-Based Programming

Event-Based Programming is based on generating events for every GUI element. This approach makes GUI an event generator & reflects the choice of users. The flow of the program and work depends on events. It is asynchronous programming or model.

For Example: hovering the mouse or cursor over a button or link, or clicking on a button or link may reflect other choices or significance.

As its name suggests, it is an event-driven-based technique. We mainly use callbacks in it. Callbacks are used to link events and code.

What are Callbacks

The callback is a mechanism in OOP, which is used to handle events. These are generally used when the function needs to perform events and a callback is executed. Implementing callback may take many forms. The callback is like an event loop that handles all the events in a systematic or computational way. An event loop is a tracker of the incoming and execution of events in the whole program.

In this approach, there is a producer of events and a subscriber of events who is always watching for events to occur.

How does event-driven programming work

It is like a producer generating an event and sending it to the subscriber. For Example, A server has an alarm system that rings at 10 am and sends a signal to its client about time. First Producers generate the events in form of an alarm, then Servers handle the event generated by producers and send them to clients in form of events to ring the alarm. Through this user sitting on the client-side get to know about time.

techniques for composing applications
Flowchart
techniques for composing applications

MVC (Model View Controller) model

The Second Composing Application Technique in android is MVC. It is divided into 3 parts, Model, View, and Controller. It is the way the information, and data is been presented to the user & how the user interacts with the view.

  • Model: Stores the application data, Handle network layer as well as database, with no information about the user interface. Manages business logic and rules of the application. In other words, what to render.
  • View: It is the UI design. Offers User interaction, how to display data to the users, or provides visualization of the data from the Model. In simple words, how to render.
  • Controller: Contains core application logic, gets notified of the user’s behavior, establishes a relationship between Model and View, and updates the Model as it needs. In simple words, handle events, and user inputs.
techniques for composing applications

In MVC, Controller and View depend on the Model. Controller to Update the data or result, View to get the data.

MVC is of 2 types:

  • Passive Model: The controller modifies or manipulates the model and notifies the View to update, View gets data from the Model. In other words, the Controller is the only class to manipulate the Model.
  • Active Model: The controller is not only the class to modify or manipulate the Model. Use Observer Pattern. The model notifies the view by an interface called Observer. The observer is always watching for updates, whenever the Model gets updated, it sends the request to View.

Auxiliary Files

Auxiliary files are used to describe attributes of applications, such as Binary data, language settings, and structural properties including menus.

Common Auxiliary files are Menu, Binary Data, Localization Information, etc.

The importance of auxiliary files is increasing. Mobile devices are improved and wireless facilities have been increasing. Auxiliary files are a considerable factor of memory consumption to handle the auxiliary data, we use many resources which are unnecessary and may use memory.

Auxiliary files needed by applications are many. For instance, there can be data files whose contents are needed for creating a valid initial state. Usually, one should compose applications so that even if some of the data files are missing, it would be possible to run the application.

A related issue is that in some systems, it is advisable to implement applications such that they always have a default data file into which data can be saved if no filename is given for saving it. In addition to data files, there can be settings or profile files. Their goals can also be many, including for instance personal preferences or information regarding the properties of available resources. Again, it is commonly a good design goal to be able to run the application with minimal or even with fully missing settings files.

More on Android Click here

Youtube Channel for Android Tutorials

Leave a Comment