$30 off During Our Annual Pro Sale. View Details »

Mobile Applications Architecture - GDG Ternopil' Architecture Components Meetup

Mobile Applications Architecture - GDG Ternopil' Architecture Components Meetup

Starting from origins of Architecture as discipline, we review strong reasons why and when to create architecture and when not. Analyzing spectrum of efforts, needed to implement certain level of architecture, we are able to make important early decisions about system architecture and it's evolution.
We come over basic principles of building effective, robust systems and clean code - KISS, YAGNI, DRY, SOLID. We overview Clean Architecture and it's implications for Mobile Apps Development.
Reviewing specifics of Android Apps Development, we come to reasoning about common Mobile Architecture Patterns, such as MVC, MVP, MVVM, VIPER, RIBs and relations between them.
Based on 4 levels of Mobile Architecture Complexity, we'll review main "levels" of technology complexity that might be introduced when implementing popular Mobile Architecture Patterns (such as Layers, Views, Dependency Injection, Coordinator Pattern and Reactive Programming).
We will talk about evolution of Mobile Applications Architecture and variations of architecture implementations and frameworks.
We will touch Google Architecture Guidelines, Architecture Components and MVVM pattern implementation in Architecture Components.
At the end of presentation we'll talk about Project Lifecycle and Agile Architecting. We'll see different stages of Project Lifecycle on example of common Startup evolution, see spectrum of efforts and needed Architecture for different stages of project evolution. We'll talk about Minimal Viable Architecture and advices for Startups architecture from Randy Shoup.

Constantine Mars

December 02, 2017
Tweet

More Decks by Constantine Mars

Other Decks in Programming

Transcript

  1. Mobile Applications Architecture Modern and eternal ways ;) Constantine Mars

    Team Lead, Senior Developer @ DataArt
  2. Software Architecture The Origins

  3. #mobarchclub Why Use Architecture? • 10:1 reading to writing ratio

  4. #mobarchclub Why Use Architecture? • 10:1 reading to writing ratio

  5. #mobarchclub Why Use Architecture? • Isolate complex or frequently changing

    code
  6. #mobarchclub Why Use Architecture? • Black box complex areas

  7. #mobarchclub Why Use Architecture? • Avoid bugs

  8. #mobarchclub Why Not Use Architecture? • Costs and benefits of

    scalability
  9. #mobarchclub Why Not Use Architecture? • No architecture for architecture’s

    sake
  10. #mobarchclub Why Not Use Architecture? • Trade-off between speed and

    technical debt
  11. #mobarchclub Why Not Use Architecture? • Spectrum of effort

  12. Main Principles Of a good architecture

  13. #mobarchclub

  14. #mobarchclub KISS = Seep It Simple Stupid

  15. #mobarchclub DRY = Don’t Repeat Yourself

  16. #mobarchclub YAGNI = You Aren’t Going to Need It!

  17. #mobarchclub SRP = Single Responsibility Principle

  18. #mobarchclub OCP - Open Closed Principle

  19. #mobarchclub LSP - Liskov Substitution Principle

  20. #mobarchclub ISP - Interface Segregation Principle

  21. #mobarchclub DIP - Dependency Inversion Principle

  22. #mobarchclub

  23. #mobarchclub Clean Architecture image from https://8thlight.com

  24. Mobile Applications Architecture Some specifics. Main complexity levels

  25. #mobarchclub Android Has “Good Bones” image from https://8thlight.com Components: -Activities

    -Fragments -Services -Content Providers -Broadcast Receivers
  26. #mobarchclub Mobile has it’s Specifics image from https://8thlight.com App-hopping OS

    may kill app at random time App components lifecycle is not under control Components should not depend on each other Can’t rely on data, stored in components
  27. #mobarchclub Android Activity Lifecycle is like this :) image from

    https://8thlight.com
  28. #mobarchclub Common Principles for Mobile -Separation of concerns -Provide solid

    user experience -Keep UI lean and simple -Keep UI free of app logic -Drive UI from model -Use persistent model -Assign clear responsibilities model classes
  29. #mobarchclub Separation of Concerns. Abstract way image from fernandocejas.com

  30. #mobarchclub Levels of Complexity of Android App Architecture 1. L1

    - Presenter / ViewModel, Layer Separation, Entities 2. Injection 3. Coordinator 4. Reactive Programming (Rx)
  31. #mobarchclub Presenter / View Model Move non-UI logic from controller

    to another class
  32. #mobarchclub Layer Separation Move network, database and business logic to

    separate layers
  33. #mobarchclub Entities Separate view from database. Little or no logic

    for entities
  34. #mobarchclub Dependency injection Decouple layers. Pass dependencies to constructor parameters

    Or use injection framework (JSR-330, Dagger, AndroidAnnotations, Juice, etc.)
  35. #mobarchclub Coordinator Move navigation logic out of views

  36. #mobarchclub Reactive Programming Automatically propagate changes between layers and use

    mapping between data in functional style
  37. Mobile Architecture Patterns Common patterns. Not only for Android

  38. #mobarchclub MVC: Model - View - Controller

  39. #mobarchclub MVP: Model - View - Presenter

  40. #mobarchclub MVVM: Model - View - ViewModel

  41. #mobarchclub VIPER

  42. #mobarchclub RIBs

  43. #mobarchclub Architecture Components

  44. #mobarchclub Architecture Components image from Guide to App Architecture

  45. Project Lifecycle. Agile Architecture Things outside app that influence architecture

    evolution
  46. #mobarchclub Minimum Viable Architecture 1. YAGNI = You aren’t going

    to need it! 2. RT-RJ-RT Use the Right Tool for the Right Job at the Right Time 3. XP - Change incrementally
  47. #mobarchclub Minimum Viable Product

  48. #mobarchclub Project (Startup) Lifecycle 1. Search Phase (Discovery, Solution Design,

    etc.) 2. Execution Phase (Project) 3. Scaling Phase
  49. #mobarchclub Search Phase 1. “No architecture at all” 2. Find

    business model and market fit 3. Acquire first customers 4. Prototype - familiar technology, cobble it together 5. Throw it away later - but not now
  50. #mobarchclub Execution Phase 1. “Just enough” architecture 2. Meet near-term

    customer needs, delight customers 3. Rapid learning and imporovement 4. Team productivity 5. Monolithic architecture 6. Minimal infrastructure 7. NOT about scaling
  51. #mobarchclub Change drives the world “The best code you can

    write now is the code you’ll discard in a couple of years” Martin Fowler
  52. #mobarchclub Monolithic Architecture • Presentation - Web (JS), Android, iOS

    • Application / Backend - Java, PHP, Ruby • Database - Firebase, MySQL, Mongo
  53. #mobarchclub Scaling Phase • Scaling the Team • Scaling the

    Technology • Concurrency and Efficiency
  54. #mobarchclub Scaling is the result of the change “If you

    don’t end up regretting your early technology decisions, you probably over-engineered” Randy Shoup
  55. #mobarchclub Scaling. “Next-Gen” Architecture • Scaling the Technology. Migrations, Concurrency,

    Other languages • Scalable persistence. Break-up monolithic DB, split to functional modules • Identify and eliminate bottlenecks. Increase performance • Re-Design interfaces
  56. Read Learn and expand

  57. #mobarchclub Read About Software Architecture Clean Architecture https://8thlight.com/blog/uncle-bob/2012/08/13/the-clean-architecture.html Architecture, the

    Lost Years by Uncle Bob https://youtu.be/WpkDN78P884 Fernando Cejas - Architecturing Android, Evolution https://fernandocejas.com/2015/07/18/architecting-android-the-evolution/ Minimum Viable Architecture https://www.slideshare.net/RandyShoup/minimum-viable-architecture-good-e nough-is-good-enough-in-a-startup Mobile Architecture Club
  58. #mobarchclub Read About Architectural Frameworks Moxy https://github.com/Arello-Mobile/Moxy Mosby https://github.com/sockeqwe/mosby Android

    MVP Helper https://github.com/Ufkoku/AndroidMVPHelper Clean Architecture https://github.com/android10/Android-CleanArchitecture Reark https://github.com/reark/reark MVP + Dagger2 + Rx https://android.jlelse.eu/mvp-dagger-2-rx-clean-modern-android-app-code- 74f63c9a6f2f Uber RIBs https://github.com/uber/RIBs
  59. #mobarchclub Read About Architecture Components Guide to App Architecture https://developer.android.com/topic/libraries/architecture/guide.html

    Architecture Components https://developer.android.com/topic/libraries/architecture/index.html I/O ‘17 Architecture Components Introduction - https://youtu.be/FrteWKKVyzI Solving the Lifecycle Problem - https://youtu.be/bEKNi1JOrNs Persistence and Offline - https://youtu.be/MfHsPGQ6bgE Architecture Components on GDD Europe - https://youtu.be/Ts-uxYiBEQ8 GDD Europe CodeLabs g.co/codelabs/gdd17 Google Github samples https://github.com/googlesamples/android-architecture-components
  60. @ConstantineMars @DataArt Thank you! :) Mobile Architecture Club