I do not consider this tutorial to be the end-all of design
patterns. Instead, I would like to consider it (and for it to be considered)
as a VB.NET companion to the GOF book. The fact that you are reading this
tutorial means that you know VB.NET quite well. The ideal situation is that
you are also technically very gifted, know C++ very well and have lots of time
on your hands. In that case, read the GoF book from cover to cover and then
read this tutorial.
Assuming you know little C++, have limited time and do not
like nitty-gritty stuff, then you can take one of several alternative
approaches:
·
Read chapter 1 of the GoF book, then read this tutorial.
or
·
Read the whole GoF book (Chapter 2 is of questionable value and
in my 2 ½ reads I never made it through that chapter), skip the C++ sample code
in each pattern, and then read this tutorial (recommended for VB.NET
developers).
or
·
Read a C++ Tutorial or book. Read Chapter 1 of the GoF book and then
for each pattern read the GoF version of the pattern (including C++ Sample
Code) and the version from this tutorial. This is the approach recommended for
lead VB.NET developers (or those who want to lead soon).
Now whatever you do, try to get a copy of the GoF book
before you read this tutorial. I am serious!!! I cannot be responsible for
any trivialization, misinterpretation or any general misguided thoughts which
come about from reading this tutorial without the book as a jumping off point. This
tutorial is not meant to teach you design patterns; it is meant ONLY for people
who understand the concepts and principles explored by the GoF and want to see
how to implement them in VB.NET. So in reality, it is only meant to “replace”
the sample code sections for each pattern. Even if you do not know C++, it is
best if you take a quick refresher or read a quick C++ primer and then struggle
through the C++ sample code because in some instances interface or
variable/class scope issues will probably get lost in translation. I am not
sounding this disclaimer so I can abdicate my responsibility for doing a good
job. Not at all, I want this tutorial to be well read and quoted because I
spent a significant number of months of my life dedicated to deepening my
knowledge of VB.NET and learning Design patterns so I could get to a point
where I could even attempt to write a tutorial on the subject of Design
Patterns in VB.NET.
But let me ask you a question (and I apologize for the
inappropriate comparison). Would you try to replace The Bible with books by
T.D. Jakes or Joyce Meyers? No! In the case of GoF-design patterns, this book
was written by four PhDs over several years after reading close to 100 books. Can
I replace that? Most definitely not and I refuse to try! So again, if you
have not yet picked up a copy of the book, go get it. This tutorial is
intended for people who want to learn the subject properly because it deserves
to be learnt well.
So having gotten the GoF book, this is how I recommend you
read it along with this tutorial:
·
Read Chapter 1 contemplatively (especially page 14 onwards) – “Specifying
Object Implementations.” This is very necessary since their use of Static
Structure Diagrams is a shade different from what you will probably see in
Visio.
·
Read all of chapters 3, 4 and 5.
·
For each pattern in Chapters 3, 4 and 5
1.
Study the Intent slowly and purposely, memorize it.
2.
Read the Motivation carefully – get all you reasonably can from it.
3.
Examine the UMLs closely and study them.
4.
Read Applicability twice, but skim more or less because it is more for
reference. In other words, later on when you are actually implementing
patterns, you should come back to check both the intent and the applicability
to see if it is the right pattern to use.
5.
Study and scrutinize the Participants closely, making reference to the
UMLs.
6.
Study Collaborations very closely - this is the 3rd most important thing.
7.
Partly skim and read the Consequences. Anything which sticks, commit to
memory; anything which does not, come back again when you are in the middle of
implementing the pattern to figure out how to make the trade-offs described in
this section.
8.
Examine the UMLs closely one more time.
9.
The Implementation tells you how language issues affect the pattern and
how to extend it and jazz it up. This is more useful later when implementing
the pattern in your design.
10.
As far as Sample Code is concerned, if you know C++ well then dive right
in, otherwise read the pattern in my VB.NET tutorial. If you want an in
between approach, then see my quick and dirty C++ to VB.NET CORGI. Further
along the road to independence, you could always pick up a good book or tutorial
on C++.
11.
Known Uses. I do not know how valuable this is. This is my opinion and
I am sticking to it. It is of some academic interest and I guess it does help
to convince you that the pattern is useful since it is incorporated into
serious systems.
12.
Related Patterns- Treat this like Applicability. You will get more out
of the Related Patterns section when you know all the patterns in that
section. Maybe you can take this more seriously on your second (and hopefully
much less confusing) reading of the book.
13.
For further reinforcement of the pattern, see my recommendations in
terms of reading sources – I recommend the top reading sources for that pattern.
·
Read Chapter 6 contemplatively.
Now do not pounce on me because I told you to skip this
chapter or skim that section. By the third reading, you should be ready to
read every juicy detail of the GoF book and glean every morsel of wisdom from
it. I am just recommending this reading strategy because the book can be a
very dense read. So this strategy will help you actually make it through the
first reading with minimum drag.