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

More Related Content

Similar to Android architecture

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-Present
SOLID principles-PresentSOLID principles-Present
SOLID principles-PresentQuang 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
 
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
 
SOLID Software Principles with C#
SOLID Software Principles with C#SOLID Software Principles with C#
SOLID Software Principles with C#
Ken Burkhardt
 
The OO Design Principles
The OO Design PrinciplesThe OO Design Principles
The OO Design Principles
Steve Zhang
 

Similar to 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
 

Recently uploaded

The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
Alison B. Lowndes
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Cheryl Hung
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Tobias Schneck
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Inflectra
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
Product School
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
Product School
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
DianaGray10
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Product School
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Ramesh Iyer
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 

Recently uploaded (20)

The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 

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.