Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Android Architecture

Gaurav
September 22, 2018

Android Architecture

Gaurav

September 22, 2018
Tweet

Other Decks in Technology

Transcript

  1. Mobile Application View Designing Code Platform APIs Consumers View Event

    Handling API Response Handling Updating State Merging Api Responses Business Logic API Calling Data Transformation View Layer Service Layer Navigation Logic Logical Layers Layered Architectures (MVC,MVP,MVVM,VIPER)
  2. Objectives of mobile app architecture ❖ Single source of truth

    for data ❖ Easily reusable business logic components ❖ Should easily separate pure and impure functions or Unit testable code. ❖ Should follow the basic SOLID principles. ❖ Architecture should be adaptive to platform APIs and external SDKs. ❖ Should be scalable and flexible while not creating the overhead for the developer to implement it. ❖ Every class of the project must be part of any architecture component
  3. Dream11 Android Architecture ❖ MVP based and Clean architecture philosophy

    ❖ RxJava ❖ Dependency Injection using factory pattern ❖ Databinding ❖ Custom components(MultiListAdapter, MessagePool)
  4. View Layer-MultiActivity and Flow State ❖ Activity for each flow

    type ❖ A flow state represent each step of the user in application ❖ View layer maps flow state with activity and fragments ❖ Feature layer execute actions and business logics according to flow state
  5. Problem Statement- MultiListAdapter ❖ Create a list which has view

    types of V1, V2, V3, V4 and their data source APIs are A1, A2, A3, A4. ❖ An API will give the ordering of views like V3, V2, V4, V1 or V2, V4, V3, V1 ❖ Display the views as soon as the response of that view is received, there should not need to wait for others, suppose if display order is V2, V4, V3, V1 and if the V3 response comes first, it should be visible to screen and shouldn’t wait for the response of V2 and V4

  6. Solution- MultiList Adapter ❖ Create different adapters for V1, V2,

    V3, V4. ❖ Add those adapters to MultiListAdapter in display order like V3, V2, V4, V1 or V2, V4, V3, V1 ❖ Assign MultiListAdapter object to recyclerview as an adapter ❖ Whenever response of any API is received, just update the respective adapter
  7. Feature Layer It is the most intelligent layer in our

    architecture, It is the part of M in MVP, it has the business logic and flow logic (decides the flow of the application). Feature classes are singleton and segregated as per the business logics
  8. Feature Layer- RequestMessagePool • It is used for the communication

    between the feature classes • Every feature class register for request types which it can handle • One request type can be registered by one feature, later will get the exception • Whenever any feature class needs to access the logic of another feature class, it asks to Request Message Pool
  9. Things to be improved- REST to GraphQL ❖ It will

    help to reduce the application state size which tends to reducing the complexity to manage the state ❖ Client will get almost view ready data so no need of mapping ❖ Will remove API response merging code ❖ Common business logics of client will be handled by GraphQL ❖ Size of feature layer will be reduced, it will help us to concentrate more on unit test cases
  10. Things to be improved- REST to GraphQL ❖ It will

    help to reduce the application state size which tends to reducing the complexity to manage the state ❖ Client will get almost view ready data so no need of mapping ❖ Will remove API response merging code ❖ Common business logics of client will be handled by GraphQL ❖ Size of feature layer will be reduced, it will help us to concentrate more on unit test cases
  11. Architecture Impact- REST to GraphQL Mobile Application View Designing Code

    Platform APIs Consumers View Event Handling API Response Handling Updating State Business Logic API Calling View Layer Service Layer Navigation Logic Logical Layers Layered Architectures (MVC,MVP,MVVM,VIPER) Merging Api Response Data Transformation
  12. Things to be improved ❖ Java to Kotlin ❖ Architecture

    enforced separation of pure and impure functions
  13. SportsGuru - ReactNative ❖ Improvised component architecture ❖ Point free

    style functional programming (Ramda) ❖ Completely on GraphQL ❖ 90% unit test coverage