Mobile Architecture 

A Word About Mobile App Architecture

Not All Architectures Are the Same

Choosing the right architecture is crucial in mobile app development, as it significantly impacts the app’s testability, scalability, and maintainability. Here’s a comparison of some common architectural patterns:

Understanding these differences helps developers select an architecture that aligns with their app’s complexity and future scalability needs.

Android

In the early days of Android development, there was a notable lack of guidance on app architecture. Without established best practices, developers resorted to their own methodologies, leading to a fragmented landscape of languages, tools, and design principles. This inconsistency resulted in many poorly designed apps populating the Play Store. Unfortunately, users often blamed Android itself, remarking that “Android sucks,” rather than recognizing the individual app shortcomings. Thankfully, Google now provides clear guidelines and best practices, helping developers create robust, consistent, and high-quality Android applications.

Learn More:

iOS

Initially, Apple advocated for the Model-View-Controller (MVC) pattern, which proved insufficient for complex applications. Many developers shifted to their own versions of Model-View-ViewModel (MVVM). However, with the introduction of new tools like Swift, SwiftUI, structured concurrency, Combine, and SwiftData, uncertainty has grown around the proper way to architect apps today. The recent addition of SwiftData exacerbates this confusion, as it doesn’t integrate well with MVVM. Apple now has an opportunity to provide the developer community with clear, cohesive architectural guidance that leverages the latest technologies — Swift, SwiftUI, structured concurrency, SwiftData, SwiftCharts, and Swift Testing.

Without this guidance, developers are left to guess how their architectures will align with future advancements in the Apple ecosystem. It’s crucial for Apple to define best practices to ensure the development of robust and maintainable iOS applications moving forward.

Why This Matters: An Example

Consider two iOS experts with differing views on using ViewModels:

Mohammad Azam

iOS expert and educator, advises against using a ViewModel.

iOS expert and Stanford instructor, consistently uses a ViewModel, adhering to the MVVM pattern.

Who’s right? If you’re using SwiftData, Azam’s approach is advantageous because SwiftData doesn’t work well with MVVM. Adhering to Azam’s guidance makes transitioning to SwiftData seamless. On the other hand, if you’ve followed Hegarty’s MVVM approach, integrating SwiftData becomes challenging.

In retrospect, it seemed negligent for Google/Android not to provide solid architectural advice in the past, and we’re now witnessing a similar situation with Apple/iOS. Without insight into Apple’s roadmap, how can developers make informed, long-term architectural decisions?

By understanding the nuances of different architectural patterns and staying informed about platform developments, developers can make better choices that will stand the test of time. 

It’s essential for platform providers like Apple and Google to offer clear architectural guidelines to support the developer community in building robust and future-proof applications.