0:09 / 3:36

Before we get to the design patterns themselves, there is just one more piece of housekeeping that

I wanted to mention, and that is to do with the so called gamma categorization.

So typically in design pattern literature, regardless of which language of design patterns we are talking

about, we are splitting all the design patterns into several different categories.

Now these categories are often called gamma categorization, and this is a name that comes after Erich

Gamma, who happens to be one of the authors of the original Gang of Four book, the book that uses

C plus Plus and Smalltalk.

So first of all, you have creational patterns.

Now, these patterns, as the name suggests, they are dealing with the creation or construction of

objects.

Now, you might think that a construction of an object is quite simply invoking the constructor, but

in actual fact things are quite often a bit more complicated.

So sure, you have explicit creation.

That’s when you call the constructor, you provide a few arguments and you get your initialized object.

But there are always situations where the creation of an object is actually implicit.

So, for example, you might be using a dependency injection framework or you might be using reflection

or some other mechanism which actually creates the object behind the scenes.

That’s also creation, but it’s not explicit creation in the sense of you calling a constructor to initialize

something.

So that’s worth mentioning.

And in addition, there are different processes for actually initializing the objects before they are

ready to use.

So sometimes you’ll have wholesale creation of an object, meaning that a single statement like a single

constructor call is actually sufficient to initialize the object.

But in certain situations, initialization itself is a complicated process and this is where we get

the so-called piecewise or step by step initialization.

That’s when you need to have several statements or several steps that need to be taken before an object

is actually initialized and ready to use.

So after the creation of patterns, we’re going to see the second category, which is structural patterns.

Now, as the name suggests, it’s mainly concerned with the structure of the classes that are involved

here.

So it’s concerned with class members.

It’s concerned with things like the class adhering to some interface or other.

So what we’re going to see here is we’re going to see, for example, many patterns which are wrappers

which mimic the underlying interface.

So you have a wrapper around the class, and that wrapper tries to mimic as much as possible the underlying

class, the class that it’s actually wrapping.

So this is an example of a structural approach here, and a structural design pattern is generally put

extra weight on the importance of good API design.

And some of the patterns are actually all about this idea of replicating the interface as much as possible

or making the interface as convenient to use as possible.

So in studying structural patterns, you’re going to see some good applications of just good API design

that makes objects usable and makes APIs usable for other people.

Finally, we’re going to take a look at behavioral design patterns.

Now, unlike the creational patterns and structural patterns, behavioral patterns don’t really follow

any central theme.

They’re all different.

They’re all doing their own thing.

There is some overlap here and there.

So for example, the strategy in the template method design pattern is they’re kind of doing the same

thing, but they’re doing it using completely different object oriented mechanisms.

So there’s going to be some overlap here and there.

But generally most of the behavioral design patterns are unique in their approach, meaning that they

solve a particular problem, they solve it in a particular way, they have a particular set of concerns.

And so we’re going to cover all of them as well.

So these are the three categories of patterns that we’re going to see as part of this course.

  • Stop

  • Play

  • Play

  • Play

  • Play

  • Play

  • Play

  • Play

  • Play

  • Start

  • Play