Model-View-Controller (MVC) is a micro-architectural pattern initially introduced for the implementation of user interfaces. As Angular developers, we use different variations of this pattern on a daily basis, most often, Model-View-ViewModel (MVVM). In MVC, we have the model, which encapsulates the business logic of our application, and the view, which is responsible for rendering the user interface, accepting user input, and delegating the user interaction logic to the controller. The view is represented as composition of components, which is formally known as the composite design pattern.
Let's take a look at the following structural diagram, which shows the composite design pattern:
Figure 5
Here, we have three classes:
- An abstract class called Component.
- Two concrete classes called Leaf and Composite. The Leaf class is a simple terminal...