SOLID Flashcards

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
Q

Fill in the blank: The _____ pattern allows classes to be composed with behavior at runtime.

26
Q

What is the purpose of the Facade pattern in Laravel?

A

To provide a static interface to classes that are available in the application’s service container.

27
Q

True or False: The MVC pattern stands for Model-View-Controller.

28
Q

What does the Model in MVC represent?

A

The data and business logic of the application.

29
Q

What does the View in MVC represent?

A

The user interface and presentation layer.

30
Q

What does the Controller in MVC do?

A

Handles user input and interacts with the model to update the view.

31
Q

What is the purpose of the Observer pattern in Laravel?

A

To allow one object to notify other objects about changes in its state.

32
Q

Fill in the blank: The _____ pattern is useful for implementing event-driven systems.

33
Q

What is the main goal of the Command pattern?

A

To encapsulate a request as an object.

34
Q

True or False: The Builder pattern is used to construct a complex object step by step.

35
Q

What is the main benefit of using design patterns in Laravel?

A

To provide proven solutions to common software design problems.

36
Q

What is the role of the Service Provider in Laravel?

A

To bootstrap and register services in the application.

37
Q

Fill in the blank: The _____ pattern allows the creation of a complex object without exposing the creation logic to the client.

38
Q

What is the purpose of the Adapter pattern?

A

To allow incompatible interfaces to work together.

39
Q

True or False: The Template Method pattern defines the skeleton of an algorithm in a method, deferring some steps to subclasses.

40
Q

What does a clean code principle emphasize regarding comments?

A

Code should be self-explanatory; comments should be used sparingly and only when necessary.

41
Q

Fill in the blank: The _____ pattern is used to convert the interface of a class into another interface clients expect.