F5 - Maintainability Flashcards
Define coupling and cohesion in software design and explain their impact on maintainability
Coupling refers to the degree of interdependence between modules, while cohesion relates to the internal structure of modules.
High coupling and low cohesion can negatively impact maintainability by increasing the likelihood of ripple effects, making systems harder to compose, reducing reusability, and increasing effort in testing.
What is the purpose of the Law of Demeter in software design?
The Law of Demeter states that objects should only communicate with objects in their immediate environment, promoting loose coupling between objects and improving code maintainability by preventing excessive dependencies
Explain the Single Responsibility Principle (SRP) and its relevance to maintainable software design
SRP states that a class should have only one reason to change. This principle helps maintainability by ensuring that each class focuses on a single responsibility, making it easier to understand, modify, and maintain.
How does the Open-Closed Principle (OCP) contribute to maintainable software design?
OCP states that components should be open for extension but closed for modification. By allowing existing behavior to remain untouched while permitting extension through inheritance and polymorphism, OCP helps maintainability by preventing unnecessary changes to existing code
Explain the purpose of the Liskov Substitution Principle (LSP) and its impact on maintainability
LSP states that subclasses should be substitutable for their base classes without altering the correctness of the program. This principle promotes maintainability by facilitating code reuse and polymorphic behavior without introducing unexpected side effects
What is the Interface Segregation Principle (ISP) and how does it influence maintainable software design?
ISP states that clients should not be forced to depend on interfaces they don’t use. By separating large interfaces into smaller, more specific ones, ISP minimizes coupling and dependencies, thus promoting a more modular and maintainable design.
Explain the Dependency Inversion Principle (DIP) and its relevance to maintainable software design.
DIP states that high-level modules should not depend on low-level modules; both should depend on abstractions. This principle promotes maintainability by promoting loose coupling and facilitating the replacement of components without affecting the overall system’s behavior
Describe the Reuse/Release Equivalence Principle (REP) and its impact on maintainable software design
REP states that the granule of reuse should be the granule of release, advocating for components to be neither too big nor too small. By ensuring that components are released and reused at an appropriate granularity, REP contributes to maintainable software design.