Book
  • Introduction
  • Welcome !!
  • Chapter 1: The mobile ecosystem
    • Fragmentation is the devil
    • There is more than one type of mobile app
    • ... more than one type of app
    • ... one type of app
    • Under pressure (ee da de da de) !!
    • Further reading!!
  • Chapter 2: Let's start with design thinking
    • A taste of design thinking
    • The five steps
    • Design for everybody
    • Accessibility in mobile apps
  • Chapter 3: Give me a context and I will give you an app
    • Users
    • Personas? Users ? What is the difference?
    • Please, help me to model the context
    • The context canvas
  • Chapter 4: Powerful models
    • Data architecture is the foundation of analytics
    • From data to information and knowledge
    • Information/Knowledge in our mobile ecosystem
    • Questions to ask yourselves when building and classifying questions
    • The visualization-data map
    • On the scene: describing how personas interact with your app
  • Chapter 5: A GUI is better than two thousand words
    • 'Good to Go:' Let's explore the Design Systems
    • Designing GUI Mocks
    • No prototype... no deal
  • Chapter 6: About mobile operating systems ... and other deamons
    • The Android OS ... son of LINUX
    • iOS son of Darwin? or is it iOS son of UNIX?
    • Kernels
  • Chapter 7: Yes, software architecture matters !!
    • Self-test time
    • About design and design constraints
    • Architects' mojo: styles and patterns
    • What you need is a tactic !!
    • Self-test time 2 (for real)
    • Further reading
  • Chapter 8: Finally... coding
    • MVC, MVVM, MV*, MV...What?
    • Programming models: the Android side
    • Hello Jetpack, my new friend... An Android Jetpack Introduction
    • Programming models: the iOS side
    • Controllers and more controllers
    • Flutter son of... simplicity
    • Programming models: Flutter?
    • Flutter: State matters... Let´s start simple
    • Flutter: State matters... Complex stuff ahead
    • Micro-optimizations
  • Chapter 9: Data pipeline
    • Generalities data pipelines
    • Data storage types
    • Types of data pipelines
  • Chapter 10: Error Retrieving Chapter 10
    • Eventual Connectivity on Mobile Apps
    • How to handle it on Android
  • Chapter 11: The jewel in the crown: Performance
    • As fast as a nail
    • Memory bloats
    • Energy leaks
    • Final thoughts
  • Chapter 12. Become a performance bugs exterminator
    • Weak or strong?
    • Micro-optimizations
    • The single thread game !!
    • Using multi-threading like a boss !!
    • Caching
    • Avoiding memory bloats
    • Further readings
Powered by GitBook
On this page

Chapter 8: Finally... coding

PreviousFurther readingNextMVC, MVVM, MV*, MV...What?

Last updated 1 year ago

(By Mario Linares-Vásquez, Laura Bello-Jiménez, Santiago Cortés-Fernández, and Rogelio García)

(Free image by Caspar Rubin on )


All right!! It's time for getting your hands "dirty" and learning mode about coding practices in mobile development. Programming mobile apps is a very interesting (and complex) topic. It is not only about learning the languages' syntax and code; you need to follow the best practices and understand what you are doing because mobile devices and Operating Systems impose several constraints on your apps. Not following the design/coding practices is a clear recipe for failure.

In addition, you should understand that each mobile platform follows a different programming model and architectural patterns. For instance, while iOS follows strictly an MVC pattern, Android apps can be implemented using other patterns like MVVM and MVI.

Independently of the platform, there are some basic rules you MUST follow before coding and designing your app:

  • Be concerned... about separating concerns in your app: do not put all your code in the GUI related components. Get knowledgeable of the programming components and the purpose of each one. Follow the developer guides that explain you how and when each component should be used.

  • Single GUI-thread policy: mobile apps run on a single thread by default. That "main" thread is on charge of painting the GUI, listening to events (GUI and system), and whatever other operation is codified. Therefore, do not miss multi-threading opportunities by using the right APIs, and let be conservative when assigning tasks to the main thread.

  • Simplicity: keep your code as simple as possible and remove the code and resources you do not really need.

  • Know the platform: again, know the mobile development platform and follow de best practices and developer guides. Components and applications have life-cycle/callback methods designed for dealing with the events-based nature of mobile apps. Mobile platforms are change-prone [^1] (in particular Android), so, be up-to-date on the changes done for each new-release of the mobile APIs and OSs.

  • Performance matters: be careful with your design decisions. Mobile devices have several constraints and there is trade-off between quality attributes (e.g., security impacts performance). Thus, think carefully about the rationale and implementation of your design decisions.

You will learn more about performance practices in Chapter 9. Chapter 8 has a brief introduction to one technique for improving performance: micro-optimizations.

[^1] G. Bavota, M. Linares-Vásquez, C. E. Bernal-Cárdenas, M. D. Penta, R. Oliveto and D. Poshyvanyk, "The Impact of API Change- and Fault-Proneness on the User Ratings of Android Apps," in IEEE Transactions on Software Engineering, vol. 41, no. 4, pp. 384-407, 1 April 2015. doi: 10.1109/TSE.2014.2367027

You can even create Android apps without following any patterns. During several years, Android developers worked like that. The good news is that Google has introduced the "", so, finally, Android developers have a guide to follow.

Android Architecture Components
Unsplash