SlideShare a Scribd company logo
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.
Android architecture
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.
Android architecture
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
Ad

More Related Content

Similar to Android architecture (20)

DesignPrinciples-and-DesignPatterns
DesignPrinciples-and-DesignPatternsDesignPrinciples-and-DesignPatterns
DesignPrinciples-and-DesignPatterns
Basavaraj Patil
 
OO Design Principles
OO Design PrinciplesOO Design Principles
OO Design Principles
Anju Kanjirathingal
 
Object Oriented Design SOLID Principles
Object Oriented Design SOLID PrinciplesObject Oriented Design SOLID Principles
Object Oriented Design SOLID Principles
rainynovember12
 
Solid design principles
Solid design principlesSolid design principles
Solid design principles
Mahmoud Asadi
 
SOLID Design Principles for Test Automaion
SOLID Design Principles for Test AutomaionSOLID Design Principles for Test Automaion
SOLID Design Principles for Test Automaion
Knoldus Inc.
 
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
Steve Westgarth
 
SOLID Principles in OOPS ooooooooo.pptx
SOLID  Principles in OOPS ooooooooo.pptxSOLID  Principles in OOPS ooooooooo.pptx
SOLID Principles in OOPS ooooooooo.pptx
banjaaring
 
SOLID principles-Present
SOLID principles-PresentSOLID principles-Present
SOLID principles-Present
Quang Nguyen
 
Software Architecture Taxonomies - modularity
Software Architecture Taxonomies - modularitySoftware Architecture Taxonomies - modularity
Software Architecture Taxonomies - modularity
Jose Emilio Labra Gayo
 
Software design principles - jinal desai
Software design principles - jinal desaiSoftware design principles - jinal desai
Software design principles - jinal desai
jinaldesailive
 
"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
 
Mobile App Architectures & Coding guidelines
Mobile App Architectures & Coding guidelinesMobile App Architectures & Coding guidelines
Mobile App Architectures & Coding guidelines
Qamar Abbas
 
Inversion of Control
Inversion of ControlInversion of Control
Inversion of Control
Shuhab Tariq
 
Solid principles
Solid principlesSolid principles
Solid principles
Kumaresh Chandra Baruri
 
SOLID_Principles_Explained_Presentation.pptx
SOLID_Principles_Explained_Presentation.pptxSOLID_Principles_Explained_Presentation.pptx
SOLID_Principles_Explained_Presentation.pptx
SahanaRV2
 
Spring ppt
Spring pptSpring ppt
Spring ppt
Mumbai Academisc
 
Soild principles
Soild principlesSoild principles
Soild principles
Avidnyat Chiddarwar
 
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
Simon Gould
 
Object Oriented Concepts and Principles
Object Oriented Concepts and PrinciplesObject Oriented Concepts and Principles
Object Oriented Concepts and Principles
deonpmeyer
 
Design principle vs design patterns
Design principle vs design patternsDesign principle vs design patterns
Design principle vs design patterns
Prabhakar Sharma
 
DesignPrinciples-and-DesignPatterns
DesignPrinciples-and-DesignPatternsDesignPrinciples-and-DesignPatterns
DesignPrinciples-and-DesignPatterns
Basavaraj Patil
 
Object Oriented Design SOLID Principles
Object Oriented Design SOLID PrinciplesObject Oriented Design SOLID Principles
Object Oriented Design SOLID Principles
rainynovember12
 
Solid design principles
Solid design principlesSolid design principles
Solid design principles
Mahmoud Asadi
 
SOLID Design Principles for Test Automaion
SOLID Design Principles for Test AutomaionSOLID Design Principles for Test Automaion
SOLID Design Principles for Test Automaion
Knoldus Inc.
 
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
Steve Westgarth
 
SOLID Principles in OOPS ooooooooo.pptx
SOLID  Principles in OOPS ooooooooo.pptxSOLID  Principles in OOPS ooooooooo.pptx
SOLID Principles in OOPS ooooooooo.pptx
banjaaring
 
SOLID principles-Present
SOLID principles-PresentSOLID principles-Present
SOLID principles-Present
Quang Nguyen
 
Software Architecture Taxonomies - modularity
Software Architecture Taxonomies - modularitySoftware Architecture Taxonomies - modularity
Software Architecture Taxonomies - modularity
Jose Emilio Labra Gayo
 
Software design principles - jinal desai
Software design principles - jinal desaiSoftware design principles - jinal desai
Software design principles - jinal desai
jinaldesailive
 
"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
 
Mobile App Architectures & Coding guidelines
Mobile App Architectures & Coding guidelinesMobile App Architectures & Coding guidelines
Mobile App Architectures & Coding guidelines
Qamar Abbas
 
Inversion of Control
Inversion of ControlInversion of Control
Inversion of Control
Shuhab Tariq
 
SOLID_Principles_Explained_Presentation.pptx
SOLID_Principles_Explained_Presentation.pptxSOLID_Principles_Explained_Presentation.pptx
SOLID_Principles_Explained_Presentation.pptx
SahanaRV2
 
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
Simon Gould
 
Object Oriented Concepts and Principles
Object Oriented Concepts and PrinciplesObject Oriented Concepts and Principles
Object Oriented Concepts and Principles
deonpmeyer
 
Design principle vs design patterns
Design principle vs design patternsDesign principle vs design patterns
Design principle vs design patterns
Prabhakar Sharma
 

Recently uploaded (20)

TrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business ConsultingTrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business Consulting
Trs Labs
 
Big Data Analytics Quick Research Guide by Arthur Morgan
Big Data Analytics Quick Research Guide by Arthur MorganBig Data Analytics Quick Research Guide by Arthur Morgan
Big Data Analytics Quick Research Guide by Arthur Morgan
Arthur Morgan
 
Mobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi ArabiaMobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi Arabia
Steve Jonas
 
tecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdftecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdf
fjgm517
 
Build Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For DevsBuild Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For Devs
Brian McKeiver
 
Procurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptxProcurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptx
Jon Hansen
 
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes
 
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath MaestroDev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
UiPathCommunity
 
Linux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdfLinux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdf
RHCSA Guru
 
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdfSAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
Precisely
 
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded DevelopersLinux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Toradex
 
Technology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data AnalyticsTechnology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data Analytics
InData Labs
 
Role of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered ManufacturingRole of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered Manufacturing
Andrew Leo
 
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
BookNet Canada
 
Generative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in BusinessGenerative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in Business
Dr. Tathagat Varma
 
2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx
Samuele Fogagnolo
 
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc
 
Cyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of securityCyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of security
riccardosl1
 
Drupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy ConsumptionDrupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy Consumption
Exove
 
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
Alan Dix
 
TrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business ConsultingTrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business Consulting
Trs Labs
 
Big Data Analytics Quick Research Guide by Arthur Morgan
Big Data Analytics Quick Research Guide by Arthur MorganBig Data Analytics Quick Research Guide by Arthur Morgan
Big Data Analytics Quick Research Guide by Arthur Morgan
Arthur Morgan
 
Mobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi ArabiaMobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi Arabia
Steve Jonas
 
tecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdftecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdf
fjgm517
 
Build Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For DevsBuild Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For Devs
Brian McKeiver
 
Procurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptxProcurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptx
Jon Hansen
 
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes
 
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath MaestroDev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
UiPathCommunity
 
Linux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdfLinux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdf
RHCSA Guru
 
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdfSAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
Precisely
 
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded DevelopersLinux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Toradex
 
Technology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data AnalyticsTechnology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data Analytics
InData Labs
 
Role of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered ManufacturingRole of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered Manufacturing
Andrew Leo
 
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
BookNet Canada
 
Generative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in BusinessGenerative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in Business
Dr. Tathagat Varma
 
2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx2025-05-Q4-2024-Investor-Presentation.pptx
2025-05-Q4-2024-Investor-Presentation.pptx
Samuele Fogagnolo
 
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc
 
Cyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of securityCyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of security
riccardosl1
 
Drupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy ConsumptionDrupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy Consumption
Exove
 
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
Alan Dix
 
Ad

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.
  • 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.
  • 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.