OOAD 2 Interfaces and the Facade pattern
A bit about interfaces “ Always Program to an Interface” We don’t necessarily mean a Java-style Interface language construct I guess you could simplify it to: Always program to a supertype
“ Always Program to an Interface” To an implementation: Dog d = new Dog(); d.bark(); To an interface: Animal a = getAnimal(“dog”); a.makeSound();
Advantages? We’re not worrying about implementations Can deal with things generically (more abstraction), reducing code Greater resilience to change We’ll see more advantages as we cover more patterns in the coming weeks
Facade pattern Takes a complex subsystem and makes it a simpler one
Subsystem Class 1 Class 5 Class 4 Class 3 Class 6 Class 2
Subsystem Class 1 Class 5 Class 4 Class 3 Class 6 Class 2 Client class
Subsystem Class 1 Class 5 Class 4 Class 3 Class 6 Class 2 Facade Client class
Subsystem Class 1 Class 5 Class 4 Class 3 Class 6 Class 2 Facade Client class Client class 2
 
Facade pattern summary Takes a complex subsystem and makes it a simpler one You can still directly access the underlying classes Example: home theatre controller Simple, unified interface Most common functions in one place You can still use the individual controllers
When to use it? To provide an easy interface to lots of subsystems Principle of Least Knowledge – reduce interactions between objects Reduces the amount of “spaghetti”

More Related Content

DOCX
Bc0051 – system software
PPTX
Introduction to Functional programming
PDF
Tdd in practice
PDF
Internal domain-specific languages
PPTX
C sharp fundamentals Part I
PPT
Oop interfaces
PDF
Java- language Lecture 7
PDF
Try the monad!
Bc0051 – system software
Introduction to Functional programming
Tdd in practice
Internal domain-specific languages
C sharp fundamentals Part I
Oop interfaces
Java- language Lecture 7
Try the monad!

Similar to Ooad 2 Interfaces And The Facade Pattern (9)

KEY
Design Patterns Course
PDF
design pattern presentation 2.pdf
PPTX
PATTERNS04 - Structural Design Patterns
PPT
Software Design Patterns
PPS
Design Patterns For 70% Of Programmers In The World
PPT
Facade pattern
PPTX
Design patterns
PPT
P Training Presentation
PDF
Mastering Design Patterns in Java: A Comprehensive Guide
Design Patterns Course
design pattern presentation 2.pdf
PATTERNS04 - Structural Design Patterns
Software Design Patterns
Design Patterns For 70% Of Programmers In The World
Facade pattern
Design patterns
P Training Presentation
Mastering Design Patterns in Java: A Comprehensive Guide
Ad

Recently uploaded (20)

PDF
NewMind AI Weekly Chronicles – August ’25 Week III
PPTX
Microsoft Excel 365/2024 Beginner's training
DOCX
search engine optimization ppt fir known well about this
PDF
Developing a website for English-speaking practice to English as a foreign la...
PDF
Taming the Chaos: How to Turn Unstructured Data into Decisions
PPTX
Benefits of Physical activity for teenagers.pptx
PDF
UiPath Agentic Automation session 1: RPA to Agents
PPTX
Final SEM Unit 1 for mit wpu at pune .pptx
PDF
Improvisation in detection of pomegranate leaf disease using transfer learni...
PDF
STKI Israel Market Study 2025 version august
PDF
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
PDF
sustainability-14-14877-v2.pddhzftheheeeee
PPTX
Chapter 5: Probability Theory and Statistics
PDF
A proposed approach for plagiarism detection in Myanmar Unicode text
PDF
Five Habits of High-Impact Board Members
PDF
How IoT Sensor Integration in 2025 is Transforming Industries Worldwide
PDF
Convolutional neural network based encoder-decoder for efficient real-time ob...
PDF
Credit Without Borders: AI and Financial Inclusion in Bangladesh
PDF
Comparative analysis of machine learning models for fake news detection in so...
PDF
Flame analysis and combustion estimation using large language and vision assi...
NewMind AI Weekly Chronicles – August ’25 Week III
Microsoft Excel 365/2024 Beginner's training
search engine optimization ppt fir known well about this
Developing a website for English-speaking practice to English as a foreign la...
Taming the Chaos: How to Turn Unstructured Data into Decisions
Benefits of Physical activity for teenagers.pptx
UiPath Agentic Automation session 1: RPA to Agents
Final SEM Unit 1 for mit wpu at pune .pptx
Improvisation in detection of pomegranate leaf disease using transfer learni...
STKI Israel Market Study 2025 version august
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
sustainability-14-14877-v2.pddhzftheheeeee
Chapter 5: Probability Theory and Statistics
A proposed approach for plagiarism detection in Myanmar Unicode text
Five Habits of High-Impact Board Members
How IoT Sensor Integration in 2025 is Transforming Industries Worldwide
Convolutional neural network based encoder-decoder for efficient real-time ob...
Credit Without Borders: AI and Financial Inclusion in Bangladesh
Comparative analysis of machine learning models for fake news detection in so...
Flame analysis and combustion estimation using large language and vision assi...
Ad

Ooad 2 Interfaces And The Facade Pattern

  • 1. OOAD 2 Interfaces and the Facade pattern
  • 2. A bit about interfaces “ Always Program to an Interface” We don’t necessarily mean a Java-style Interface language construct I guess you could simplify it to: Always program to a supertype
  • 3. “ Always Program to an Interface” To an implementation: Dog d = new Dog(); d.bark(); To an interface: Animal a = getAnimal(“dog”); a.makeSound();
  • 4. Advantages? We’re not worrying about implementations Can deal with things generically (more abstraction), reducing code Greater resilience to change We’ll see more advantages as we cover more patterns in the coming weeks
  • 5. Facade pattern Takes a complex subsystem and makes it a simpler one
  • 6. Subsystem Class 1 Class 5 Class 4 Class 3 Class 6 Class 2
  • 7. Subsystem Class 1 Class 5 Class 4 Class 3 Class 6 Class 2 Client class
  • 8. Subsystem Class 1 Class 5 Class 4 Class 3 Class 6 Class 2 Facade Client class
  • 9. Subsystem Class 1 Class 5 Class 4 Class 3 Class 6 Class 2 Facade Client class Client class 2
  • 10.  
  • 11. Facade pattern summary Takes a complex subsystem and makes it a simpler one You can still directly access the underlying classes Example: home theatre controller Simple, unified interface Most common functions in one place You can still use the individual controllers
  • 12. When to use it? To provide an easy interface to lots of subsystems Principle of Least Knowledge – reduce interactions between objects Reduces the amount of “spaghetti”