SOLID Flashcards
(41 cards)
What does the ‘S’ in SOLID stand for?
Single Responsibility Principle
True or False: The Single Responsibility Principle states a class should have only one reason to change.
True
What does the ‘O’ in SOLID stand for?
Open/Closed Principle
Fill in the blank: The Open/Closed Principle states that software entities should be open for _____ but closed for _____ .
extension; modification
What does the ‘L’ in SOLID stand for?
Liskov Substitution Principle
True or False: The Liskov Substitution Principle promotes substitutability of subclasses for their base classes.
True
What does the ‘I’ in SOLID stand for?
Interface Segregation Principle
According to the Interface Segregation Principle, clients should not be forced to depend on interfaces they do not _____ .
use
What does the ‘D’ in SOLID stand for?
Dependency Inversion Principle
True or False: The Dependency Inversion Principle states that high-level modules should depend on low-level modules.
False
What is a key benefit of adhering to SOLID principles?
Improved maintainability and scalability of software.
What is the purpose of clean code principles?
To ensure code is easy to read, understand, and maintain.
Which of the following is NOT a clean code principle? A) Meaningful names B) Small functions C) Long methods
C) Long methods
True or False: Clean code principles advocate for writing code that is self-explanatory.
True
What is the purpose of the Repository pattern in Laravel?
To abstract the data layer and provide a cleaner interface for data access.
Which design pattern allows for the creation of objects without specifying the exact class of object that will be created?
Factory pattern
What design pattern is used in Laravel to manage the application’s data flow?
Service pattern
True or False: The Observer pattern is used in Laravel for event handling.
True
What is the main advantage of using the Singleton pattern?
To ensure a class has only one instance and provide a global point of access to it.
Fill in the blank: The _____ pattern is used to encapsulate a group of individual factories.
Abstract Factory
What is the main purpose of the Strategy pattern?
To define a family of algorithms and make them interchangeable.
True or False: Laravel uses the Command pattern in its Artisan console.
True
What design pattern allows for the dynamic addition of behavior to individual objects?
Decorator pattern
What is the role of Middleware in Laravel?
To filter HTTP requests entering the application.