SOLID Principles in Object-Oriented Design

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/19

flashcard set

Earn XP

Description and Tags

Vocabulary flashcards covering the key terms and principles presented in the lecture on SOLID object-oriented design.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

20 Terms

1
New cards

Structured Programming

A programming paradigm that emphasises linear control flow and discourages the use of unconditional jumps (gotos considered harmful).

2
New cards

Object-Oriented Programming (OOP)

A programming paradigm based on encapsulating data and behaviour inside interacting objects.

3
New cards

Object-Oriented Design (OOD)

The planning phase of OOP focused on organising classes, responsibilities and interactions to produce software that is easy to modify, extend and maintain.

4
New cards

Robert C. Martin ("Uncle Bob")

Author of “Clean Code” and promoter of the SOLID principles for agile, maintainable software.

5
New cards

SOLID

A mnemonic for five design principles—Single Responsibility, Open/Closed, Liskov Substitution, Interface Segregation and Dependency Inversion—that guide dependency management and maintainability.

6
New cards

Single Responsibility Principle (SRP)

States that a class should have only one reason to change, promoting high cohesion within the class.

7
New cards

Cohesion

The degree to which the responsibilities of a module or class are functionally related.

8
New cards

Book / BookPrinter Example

Illustrates SRP by separating text-related behaviour (Book) from output formatting responsibilities (BookPrinter).

9
New cards

Open/Closed Principle (OCP)

Classes should be open for extension but closed for modification, favouring new behaviour through inheritance or composition over altering existing code.

10
New cards

Private Instance Variables Heuristic

Supporting rule for OCP: keep instance variables private to avoid forcing changes in dependent code.

11
New cards

Liskov Substitution Principle (LSP)

Subtypes must be substitutable for their base types without altering the correctness of the program.

12
New cards

Car / ElectricCar Violation

Demonstrates LSP failure when an ElectricCar cannot implement turnOnEngine(), revealing a wrong abstraction.

13
New cards

Interface Segregation Principle (ISP)

Clients should not be forced to depend on methods they do not use; prefer several specific interfaces to one "fat" interface.

14
New cards

BearKeeper Example

Shows ISP by splitting a broad BearKeeper interface into BearCleaner, BearFeeder and BearPetter to reduce unnecessary coupling.

15
New cards

Fat Interface

An interface that exposes methods irrelevant to some of its clients, leading to unwanted dependencies.

16
New cards

Dependency Inversion Principle (DIP)

High-level and low-level modules should depend on abstractions, not on concrete classes, enabling decoupled and reusable components.

17
New cards

Abstraction

A stable interface (e.g., an abstract class or interface) that both high-level and low-level components depend on under DIP.

18
New cards

High-Level Component

Module that embodies business rules or policy; should not rely directly on concrete utility or infrastructure classes.

19
New cards

Low-Level Component

Module providing implementation details such as I/O or frameworks; under DIP it depends on abstractions rather than dictating them.

20
New cards

Decoupling

Reducing direct dependencies between modules, improving reuse and maintainability—central goal of DIP and SOLID overall.