SOLID Flashcards

(41 cards)

1
Q

What does the ‘S’ in SOLID stand for?

A

Single Responsibility Principle

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

True or False: The Single Responsibility Principle states a class should have only one reason to change.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What does the ‘O’ in SOLID stand for?

A

Open/Closed Principle

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Fill in the blank: The Open/Closed Principle states that software entities should be open for _____ but closed for _____ .

A

extension; modification

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What does the ‘L’ in SOLID stand for?

A

Liskov Substitution Principle

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

True or False: The Liskov Substitution Principle promotes substitutability of subclasses for their base classes.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What does the ‘I’ in SOLID stand for?

A

Interface Segregation Principle

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

According to the Interface Segregation Principle, clients should not be forced to depend on interfaces they do not _____ .

A

use

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What does the ‘D’ in SOLID stand for?

A

Dependency Inversion Principle

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

True or False: The Dependency Inversion Principle states that high-level modules should depend on low-level modules.

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is a key benefit of adhering to SOLID principles?

A

Improved maintainability and scalability of software.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is the purpose of clean code principles?

A

To ensure code is easy to read, understand, and maintain.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Which of the following is NOT a clean code principle? A) Meaningful names B) Small functions C) Long methods

A

C) Long methods

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

True or False: Clean code principles advocate for writing code that is self-explanatory.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is the purpose of the Repository pattern in Laravel?

A

To abstract the data layer and provide a cleaner interface for data access.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Which design pattern allows for the creation of objects without specifying the exact class of object that will be created?

A

Factory pattern

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

What design pattern is used in Laravel to manage the application’s data flow?

A

Service pattern

18
Q

True or False: The Observer pattern is used in Laravel for event handling.

19
Q

What is the main advantage of using the Singleton pattern?

A

To ensure a class has only one instance and provide a global point of access to it.

20
Q

Fill in the blank: The _____ pattern is used to encapsulate a group of individual factories.

A

Abstract Factory

21
Q

What is the main purpose of the Strategy pattern?

A

To define a family of algorithms and make them interchangeable.

22
Q

True or False: Laravel uses the Command pattern in its Artisan console.

23
Q

What design pattern allows for the dynamic addition of behavior to individual objects?

A

Decorator pattern

24
Q

What is the role of Middleware in Laravel?

A

To filter HTTP requests entering the application.

25
Fill in the blank: The _____ pattern allows classes to be composed with behavior at runtime.
Decorator
26
What is the purpose of the Facade pattern in Laravel?
To provide a static interface to classes that are available in the application's service container.
27
True or False: The MVC pattern stands for Model-View-Controller.
True
28
What does the Model in MVC represent?
The data and business logic of the application.
29
What does the View in MVC represent?
The user interface and presentation layer.
30
What does the Controller in MVC do?
Handles user input and interacts with the model to update the view.
31
What is the purpose of the Observer pattern in Laravel?
To allow one object to notify other objects about changes in its state.
32
Fill in the blank: The _____ pattern is useful for implementing event-driven systems.
Observer
33
What is the main goal of the Command pattern?
To encapsulate a request as an object.
34
True or False: The Builder pattern is used to construct a complex object step by step.
True
35
What is the main benefit of using design patterns in Laravel?
To provide proven solutions to common software design problems.
36
What is the role of the Service Provider in Laravel?
To bootstrap and register services in the application.
37
Fill in the blank: The _____ pattern allows the creation of a complex object without exposing the creation logic to the client.
Builder
38
What is the purpose of the Adapter pattern?
To allow incompatible interfaces to work together.
39
True or False: The Template Method pattern defines the skeleton of an algorithm in a method, deferring some steps to subclasses.
True
40
What does a clean code principle emphasize regarding comments?
Code should be self-explanatory; comments should be used sparingly and only when necessary.
41
Fill in the blank: The _____ pattern is used to convert the interface of a class into another interface clients expect.
Adapter