Design Patterns Flashcards Preview

Interview - C# > Design Patterns > Flashcards

Flashcards in Design Patterns Deck (6)
Loading flashcards...
1

What is Singleton Pattern?

Singleton pattern is when only one instance of a class is created which will be available to the whole application.

2

What are the advantages of the Singleton Pattern?

The Singleton pattern saves memory because a single instance of a class is reused again and again without needing to create a new object for each request.

3

What are the drawbacks of using the Singleton Pattern?

1. Singleton causes code to be tightly coupled.
2. Singleton Pattern does not support inheritance.

4

What is the Factory Pattern?

The Factory Pattern uses an interface or abstract class for creating an object but lets the sub-classes decide which class to instantiate.

5

What are the advantages of the Factory Pattern?

The Factory Pattern hides creation logic from dependent code and allows for loosely coupled code.

6

What is Lazy Loading?

Lazy Loading refers to deferring object initialization until the first time the object is needed.