Android Application Structure Flashcards
List some of the components found in android application
services, activities, fragments, broad cast receivers and
content providers
What is the purpose of the app manifest
The app manifest is used by the Android OS to integrate the app
into the device’s overall UX.
Describe the design principal: separation of concerns
Ensures that the various application modules are independently modeled, including dedicating UI classes to strictly code that controls the UI and app interaction, while dedicating other non-UI
related classes to code that maintains an app’s business logic.
Why is there need to adhere to separation of concerns
Due to the highly dynamic usage of an Android device by the user,
and given the constrained resources by the environment, there is need to separation of concerns,
What are some of the effects of failing to adhere to separation of concerns
– Loss of data on app failure
– Frequent crashes in case of network/other incident failure
– Difficulty in code debugging (error-proneness)
What are some of the benefits of adhering to separation of concerns
– Data consistency
– Less app crashes, if any at all
– Ease of debugging and testing
– More robust apps
– Application scalability
What are the three layers of an android application structure. Illustrate the same
– UI layer
– Data layer
– Domain layer (optional- to facilitate interaction between the two main ones
*See page 5 for illustration
Describe the UI layer, giving its alternative name and role
● The UI layer is made up of:
– UI elements that render data on the screen
– State holders that hold data, expose it to the UI, and handle logic
● The main role of this layer, aka the presentation layer, is to display app data on a screen
What is the data layer made up of?
– Repositories (containing data sources) which:
● Expose data to the app
● Centralize data changes
● Resolve data source conflicts
● Abstract data source from the app
● Contain business logic
What is the main purpose of the data layer
To contain the business logic, giving an app its value by containing rules
that determine the apps behaviors such as creation, data
storage and data changes.
Describe the domain layer
● This is an optional layer that may sit in between the initial two layers
● It comes in handy in complex application in order to encapsulate complex business logic or simple business
logic that is reused by multiple ViewModels.
● Not all apps have this requirement, therefore making the layer optional
What is a view model
A ViewModel is a class that is responsible for preparing and managing the data for an Activity or a Fragment
What are the advantages of Adopting this Android
Structure/Architecture
● It improves app maintainability, quality and
robustness
● Allows app scalability
● Helps with onboarding given project consistency for quicker adaptation by team members
● It ensures ease of testing
● Improves the debugging process
Describe 8 Android Dev Best Practices
● Don’t store data in app components
● Reduce dependencies on Android classes
● Create well-defined boundaries of responsibility between various modules in an application
● Expose as little as possible from each module
● Focus on the unique core of your app in order to stand out from other applications
● Make each part of your app testable in isolation
● Ensure that types are responsible for their concurrency policies
● Persist as much relevant and fresh data as possible to ensure app functionality continuity