SlideShare ist ein Scribd-Unternehmen logo
1 von 20
SOLID Principles
&
Architecture in Android
Problem
SOLID Design Pattern
! Reduces tight coupling between classes.
! Loose coupled classes minimise change in code.
! Helps in making code more reusable, maintainable,
flexible, stable and suitable to work in a team.
! SOLID represents 5 design principles.
SOLID- 5 Design Principles
! S - Single Reasonability Principle
! O - Open - Closed Principle
! L - Liskov Substitution Principle
! I - Interface Segregation Principle
! D - Dependency Inversion Principle
Single Reasonability Principle (SRP)
It says that there should be not more than one reason for a  class
to change and has only one responsibility.
Open - Closed Principle (OCP)
• Open - Software entities should be open for extension.
• Closed - Closed for modification.
Liskov Substitution Principle (LSP)
It states that Derived or child classes must be substitutable for
their base or parent classes.
Interface Segregation Principle (ISP)
• It state that do not force any client to implement an interface
which is irrelevant to them.
• Avoid Interface Pollution.
Dependency Inversion Principle (DIP)
• Talks about Coupling between two modules.
• High-Level Modules shouldn’t depend on low level modules.
Both should depend on abstraction.
• It focuses on the approach where the higher classes are not
dependent on the lower classes instead depend upon the
abstraction of the lower classes.
Architecture Pattern
! Software Architecture pattern promotes organised
programming.
! Separates application functionality which is easy to test
and provide low cost maintenance.
! MVC, MVP, MVVM are some popular design pattern.
MVC (Model View Controller)
Controller
(Activity/Fragment)
View
(Rendering UI)
Model
(Data State + Business
Logic)
Trigger request
Process
the
request
Update
response
N
otifies
Sometimes interact with View
Advantage
! It keep business logic separate in the model.
! Support asynchronous techniques
! Modification does not affect the entire model
! Faster development process
Problem
! Due to large code controller is unmanageable.
! Hinders the Unit testing
! Increased Complexity
MVP (Model View Presenter)
Presenter
(Intermediate)
View
(XML/Activity/Fragment)
Model
(Data State + Business
Logic)
Inform
user action
Process
the
request
Update
response
Save
&
N
otifies
Advantage
! Code is more readable and maintainable
! Easy testing as business logic separated from UI
! Reusable of View and Presenter
Problem
! Tight coupling between View and Presenter
! Huge amount of interfaces for interaction between layers.
! Code size is quite excessive.
MVVM
(Model View ViewModel)
ViewModel
(Intermediate/
RxJava/ LiveData)
View
(XML)
Repository
Local
(DataSource)
Remote
(DataSource)
Model
UI Event Observe
Response
Observe model, change callbacks
Send request
Send response
Receives
data
Receivesdata
Send
response
Advantage
! No tight coupling between view and view model
! No interfaces between view and model.
! Easy to unit testing and code is event driven.
Problem
! You have to create observables for each UI component.
More Cents
https://blog.mindorks.com/user/profile/id/17193
https://github.com/vandanasri
Tha󰇳󰈬 󰈘󰈢󰇼!
@ask_vandana
https://www.linkedin.com/in/androidexpertvandana

Weitere ähnliche Inhalte

Ähnlich wie Android architecture

SOLID principles-Present
SOLID principles-PresentSOLID principles-Present
SOLID principles-Present
Quang Nguyen
 
"Up-Down Development & DSL-first approach", Владимир Мельник, DataArt
 "Up-Down Development & DSL-first approach", Владимир Мельник, DataArt "Up-Down Development & DSL-first approach", Владимир Мельник, DataArt
"Up-Down Development & DSL-first approach", Владимир Мельник, DataArt
DataArt
 

Ähnlich wie Android architecture (20)

DesignPrinciples-and-DesignPatterns
DesignPrinciples-and-DesignPatternsDesignPrinciples-and-DesignPatterns
DesignPrinciples-and-DesignPatterns
 
OO Design Principles
OO Design PrinciplesOO Design Principles
OO Design Principles
 
Object Oriented Design SOLID Principles
Object Oriented Design SOLID PrinciplesObject Oriented Design SOLID Principles
Object Oriented Design SOLID Principles
 
Solid design principles
Solid design principlesSolid design principles
Solid design principles
 
SOLID Design Principles for Test Automaion
SOLID Design Principles for Test AutomaionSOLID Design Principles for Test Automaion
SOLID Design Principles for Test Automaion
 
Entity Framework: To the Unit of Work Design Pattern and Beyond
Entity Framework: To the Unit of Work Design Pattern and BeyondEntity Framework: To the Unit of Work Design Pattern and Beyond
Entity Framework: To the Unit of Work Design Pattern and Beyond
 
SOLID principles-Present
SOLID principles-PresentSOLID principles-Present
SOLID principles-Present
 
Software Architecture Taxonomies - modularity
Software Architecture Taxonomies - modularitySoftware Architecture Taxonomies - modularity
Software Architecture Taxonomies - modularity
 
Software design principles - jinal desai
Software design principles - jinal desaiSoftware design principles - jinal desai
Software design principles - jinal desai
 
"Up-Down Development & DSL-first approach", Владимир Мельник, DataArt
 "Up-Down Development & DSL-first approach", Владимир Мельник, DataArt "Up-Down Development & DSL-first approach", Владимир Мельник, DataArt
"Up-Down Development & DSL-first approach", Владимир Мельник, DataArt
 
Mobile App Architectures & Coding guidelines
Mobile App Architectures & Coding guidelinesMobile App Architectures & Coding guidelines
Mobile App Architectures & Coding guidelines
 
Inversion of Control
Inversion of ControlInversion of Control
Inversion of Control
 
Solid principles
Solid principlesSolid principles
Solid principles
 
Spring ppt
Spring pptSpring ppt
Spring ppt
 
Soild principles
Soild principlesSoild principles
Soild principles
 
Solid OO & Clean Coding is essential to successful Agile development
Solid OO & Clean Coding is essential to successful Agile developmentSolid OO & Clean Coding is essential to successful Agile development
Solid OO & Clean Coding is essential to successful Agile development
 
Object Oriented Concepts and Principles
Object Oriented Concepts and PrinciplesObject Oriented Concepts and Principles
Object Oriented Concepts and Principles
 
Design principle vs design patterns
Design principle vs design patternsDesign principle vs design patterns
Design principle vs design patterns
 
SOLID Software Principles with C#
SOLID Software Principles with C#SOLID Software Principles with C#
SOLID Software Principles with C#
 
The OO Design Principles
The OO Design PrinciplesThe OO Design Principles
The OO Design Principles
 

Kürzlich hochgeladen

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Kürzlich hochgeladen (20)

Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdf
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 

Android architecture

  • 3. SOLID Design Pattern ! Reduces tight coupling between classes. ! Loose coupled classes minimise change in code. ! Helps in making code more reusable, maintainable, flexible, stable and suitable to work in a team. ! SOLID represents 5 design principles.
  • 4. SOLID- 5 Design Principles ! S - Single Reasonability Principle ! O - Open - Closed Principle ! L - Liskov Substitution Principle ! I - Interface Segregation Principle ! D - Dependency Inversion Principle
  • 5. Single Reasonability Principle (SRP) It says that there should be not more than one reason for a  class to change and has only one responsibility.
  • 6. Open - Closed Principle (OCP) • Open - Software entities should be open for extension. • Closed - Closed for modification.
  • 7.
  • 8. Liskov Substitution Principle (LSP) It states that Derived or child classes must be substitutable for their base or parent classes.
  • 9. Interface Segregation Principle (ISP) • It state that do not force any client to implement an interface which is irrelevant to them. • Avoid Interface Pollution.
  • 10. Dependency Inversion Principle (DIP) • Talks about Coupling between two modules. • High-Level Modules shouldn’t depend on low level modules. Both should depend on abstraction. • It focuses on the approach where the higher classes are not dependent on the lower classes instead depend upon the abstraction of the lower classes.
  • 11.
  • 12. Architecture Pattern ! Software Architecture pattern promotes organised programming. ! Separates application functionality which is easy to test and provide low cost maintenance. ! MVC, MVP, MVVM are some popular design pattern.
  • 13. MVC (Model View Controller) Controller (Activity/Fragment) View (Rendering UI) Model (Data State + Business Logic) Trigger request Process the request Update response N otifies Sometimes interact with View
  • 14. Advantage ! It keep business logic separate in the model. ! Support asynchronous techniques ! Modification does not affect the entire model ! Faster development process Problem ! Due to large code controller is unmanageable. ! Hinders the Unit testing ! Increased Complexity
  • 15. MVP (Model View Presenter) Presenter (Intermediate) View (XML/Activity/Fragment) Model (Data State + Business Logic) Inform user action Process the request Update response Save & N otifies
  • 16. Advantage ! Code is more readable and maintainable ! Easy testing as business logic separated from UI ! Reusable of View and Presenter Problem ! Tight coupling between View and Presenter ! Huge amount of interfaces for interaction between layers. ! Code size is quite excessive.
  • 17. MVVM (Model View ViewModel) ViewModel (Intermediate/ RxJava/ LiveData) View (XML) Repository Local (DataSource) Remote (DataSource) Model UI Event Observe Response Observe model, change callbacks Send request Send response Receives data Receivesdata Send response
  • 18. Advantage ! No tight coupling between view and view model ! No interfaces between view and model. ! Easy to unit testing and code is event driven. Problem ! You have to create observables for each UI component.