Posted on by & filed under Design Patterns, java, Learning & Development, programming, Programming & Development, Tech.


Today, Safari is kicking off its Design Patterns Series. Over the course of the next seven days, you’ll become familiar with object-oriented Design Patterns by working through some of the materials that are available to you through Safari.

The Plan

Throughout the this series, the main readings will come from Head First Design Patterns. It’s currently Amazon’s number one best seller in Computer Systems Analysis & Design, and after you read a few chapters, hopefully you’ll see why. Its style is very conversational, making it reasonably easy (and even fun) to read. The technical content is sound. But more importantly, it puts Design Patterns into context: it ties them to the basic principles of object-oriented design.

After reading a chapter from Head First, you’ll skim the description of the same pattern in Design Patterns: Elements of Reusable Object-Oriented Software. This is the original Design Patterns book, the book that named and defined each of the Design Patterns for the first time. Its authors — Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides — are often called the “Gang of Four,” so this is referred to as “The GoF Book.” The descriptions in this book are authoritative: if you want a definitive answer about a pattern, this is the first place you should look.

If You Don’t Know Java

The main readings will come from Head First Design Patterns. It uses Java throughout the book, but C# programmers should have no trouble understanding it. Secondary readings come from the GoF book, which primarily uses C++, occasionally describing issues arising in Smalltalk. There are books on Safari that cover Design Patterns in C#, Objective-C, JavaScript, PHP, Python, and Ruby. Each day, we’ll give pointers to the relevant chapters of those books. So if Java isn’t your style, feel free to focus on the relevant chapters from one of these books instead, and then skim the suggested reading afterwards.

Dive in Head First

Without further ado, let’s start learning about Design Patterns! Today’s main goal is to learn what Design Patterns are exactly and why they’re useful.

  1. Start by reading the first part of chapter 5 from Shalloway and Trott’s Design Patterns Explained: A New Perspective on Object-Oriented Design (second edition), which gives an excellent, high-level overview of why Design Patterns are worth learning and where they originated from:

    Chapter 5. An Introduction to Design Patterns

    Stop when you get to the section “Other Advantages of Studying Design Patterns” (unless you just want to keep reading).

  2. Now, for the main reading: read chapter 1 from Head First Design Patterns:

    Chapter 1. Intro to Design Patterns: Welcome to Design Patterns

  3. Do you understand what Design Patterns are? Check yourself by reading the first part of chapter 1 from the original Design Patterns book, a.k.a. “the GoF book,” to see how the Gang of Four describes the concept:

    Chapter 1. Introduction

    Skip the section “Design Patterns in Smalltalk MVC” and stop when you get to “The Catalog of Design Patterns.”

Test Your Knowledge

Each day, we’ll post two or three questions about the readings. Don’t worry, you can’t fail (and no one’s recording your answers unless you are!).

Usually, the questions will reiterate a couple of interesting or subtle points that you might have missed (yes, sometimes important details get “buried” in a chapter and are easy to overlook). They’re not a comprehensive test, and they’re not a certification exam. Sometimes the questions will put a concept from the chapter into a broader context, and they’ll point you to other resources on Safari where you can learn
more about that concept.

So for now, try out these questions about Design Patterns:

    1. The Gang of Four was influenced by Christopher Alexander. Who was he?

    1. True or False: Linked lists are an example of a Design Pattern.

  1. Consider the design principle, “Program to an interface, not an implementation.” If a Java program does not contain any interface definitions, does it violate this principle?

Next Time

That’s all for today! Starting tomorrow, we’ll begin studying some of the major Design Patterns in detail. We’ll focus on two patterns each day through the end of the Design Pattern series. On the last day, we’ll point you to the wide variety of resources on Safari that you can use to continue learning about Design Patterns in more depth.

Tomorrow, we’ll begin by looking at a two patterns that are used ubiquitously in user interface programming: the Observer and Decorator patterns.

Tags: design patterns, gang of four, java, Learning, programming,

Comments are closed.