Q&A
- What are the benefits of combining design patterns?
When you combine design patterns, you generally want to use the best traits of each pattern. For example, you may leverage the Singleton pattern with any other pattern that needs to exist only once in the application life cycle. In other cases, you want to leverage their similarities, for example, with the Observer and Mediator patterns.
- What is the difference between the
Omit
andPick
utility types?Omit<U, T>
lets you pick all properties from the existing typeU
and then remove the specified keys of typeT
. It will create a new type consisting of omitted propertiesT
from typeU
.Pick<U, T>
, on the other hand, does the opposite. You specify the parameters you want to extract from typeU
without checking for any relationship with typeT
. It will create a new type consisting of the selected propertiesT
of typeU
. - How is DRY different from SOLID?
Both are basic engineering principles. With DRY, you avoid...