Chapter 3 ■ IntroduCtIon to MVC
Sometimes, you will find a lot more information about a design pattern than what I present here, but usually you
will find at least this much to help you understand its purpose and its intended uses.
■ Tip there is a school of thought that says that MVC is not a design pattern at all, rather it’s an an architectural
pattern. there is no right or wrong answer, in my opinion, and the important word here is pattern.
After reading through any given design pattern documentation and looking at any associated diagrams (which
are usually UML based; see the Tip here), you are typically in a much better position to determine if it is applicable to
the particular problem you are trying to solve. Patterns certainly are a tremendously useful resource, but there is one
really important thing to understand about them up front: they are not silver bullets. Think of them more like friends
that give good advice and not so much like divine intervention when you can’t find an answer.
■ Tip the unified Modeling Language (uML) is a general-purpose modeling language used in software development.
It provides a standard way to visualize the design of software systems.
Let’s study a very common and relatively straightforward design pattern called the Singleton pattern. This one
is well worth knowing as an AngularJS developer, though I have chosen it mainly because it is more digestible in this
introductory book than other, more involved design patterns. I don’t want to scare you off quite so early in the book!
Read through the sample Singleton pattern documentation in Table 3-2.
Table 3-1. Typical Design Pattern Documentation
Title Description
Pattern Name and
Classification
A name that helps in referring to the pattern, often
with a classification stating the type of pattern it is
Intent The goal of the pattern and the reason it exists
Motivation A scenario consisting of a problem and a context in
which this pattern can be used
Collaboration A description of how classes and objects used in the
pattern interact
Sample Code Actual code showing how the pattern can be used in a
programming language