The Artima Developer Community
Sponsored Link

Weblogs Forum
Announcing Head First Design Patterns

9 replies on 1 page. Most recent reply: Mar 3, 2016 11:37 AM by sheir ali

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 9 replies on 1 page
Eric Freeman

Posts: 30
Nickname: erictfree
Registered: Apr, 2003

Announcing Head First Design Patterns (View in Weblogs)
Posted: Nov 11, 2004 4:42 PM
Reply to this message Reply
Summary
Not your father's Design Patterns book, Head First Design Patterns provides a unique learning guide to Design Patterns and OO design.
Advertisement
Well, after a few years of talking about writing a patterns book with Mike Hendrickson (the editor behind many of the existing DP books we know and love), it has finally happened: I'm happy to announce that Head First Design Patterns is shipping on Amazon and to booksellers.

You might be saying "So what?" "Do we really need yet another patterns book?" Well, we think you'll find this book unlike any design patterns book you've come across. Why? This is truly written as a "learning book" meant to get you up to speed on what patterns are, when and why to use them (and when not to). If you're a Jr. or Mid-level developer and need to get up to speed on patterns, this book is for you. If you're an experienced programmer but don't feel you know everything about patterns you should? We think this book is for you too. Finally, even if you're a true design patterns expert we think you'll get a kick out of this book and it will actually provide some alpha-geek entertainment (and we know several people in this category who have already told us that is just the case).

A lot of what makes this book unique is its use of the Head First style. If you haven't encountered a Head First book (Head First is a fairly new series being published by O'Reilly), you'll find them written in a visually-rich style that uses conversational language, pop culture references, a fair bit of humour and some occasional irreverance. These books also strive to be technically accurate and complete. I think it's fair to say that the creators of the Head First format, Kathy Sierra and Bert Bates, have developed a near cult like following for this series because it delivers what it promises: a technical page turner that teaches you what you need to know in a way that sticks.

My co-author Elisabeth Freeman and I have found the development of this book so interesting that we're going to be putting out a few articles over the next month or so about the book and the work that went into it and some of the reaction of the patterns community.

Just after its publication, a reviewer, Eric Wuehler, on Amazon summed up the book like this: Other books on design patterns are saying, "Buehler... Buehler... Buehler..." while this book is on the float belting out "Shake it up, baby!"

Exactly the reaction we hoped for...

If you'd like to take a look at the book, Chapter 3 has been posted on O'Reilly's web site.

Eric


Michael Feathers

Posts: 448
Nickname: mfeathers
Registered: Jul, 2003

Re: Announcing Head First Design Patterns Posted: Nov 11, 2004 6:50 PM
Reply to this message Reply
Well, I've looked at chapter 3, and I think that it is nervy to put the picture I have, inside my head, of decorator (a.k.a "the onion pattern") out there for the whole world to see.. I mean, if you are going to take people's mental models and just put them out there on the page and make them clever, cute, and memorable.. well.. all I have to say is: great job!

BTW, how did you get my mental picture of decorator?

Vincent Brabant

Posts: 1
Nickname: vbb
Registered: Nov, 2004

Re: Announcing Head First Design Patterns Posted: Nov 14, 2004 1:46 PM
Reply to this message Reply
Begin of this year, I contacted a french computer book editor and propose him to write a book concerning Design Patterns .

What ? Another Design Patterns book ? There are so much Design Patterns books on the market. Why do you want to write another one

Reason is that all Design Patterns book I readed by myself were not sufficient for me. Something was missing.

I sended to him a draft of my table of contents and in my table of contents, I had the following:

[...]
Decorator Pattern
Image:
Artichaud (before you reach the core, you need to remove a lot of leaves. All thoses leaves are similar and you really have no idea which one will be the last one).

[it was something similar to onion image of other reply]

Somes Examples of the Implementation:
JAVA IO,
JUNIT
[...]

And it's exactly those kind of images and examples I find in your book excerpt.


Concerning the Singleton, I used as image the following:

The Ovule is your class (yes, a class)
The Spermatozoids are threads that will ask to the class to have one instance (something that is living, like a baby)
But, as you know, only one spermatozoïd can reach the ovule and start the process of instanciation of the baby.
Others spermatozoïd can't.
And I gave somes examples of bad implementation, where more than one spermatozoïds could reach the ovule and finally, we had two or more babies, in place of one.

I would like to know which kind of image/illustration you used for the Singleton Pattern. Just curious.

Just to say that the book you wrote is very similar to the one I was busy to write. And I am really happy with that. It means that I was not wrong by writing that book.

I hope that now I could continue to write my book, or maybe I have to contact oreilly and ask them to be the french translator of your book.

Vincent Brabant
http://fr.netbeans.org

Matt Gerrans

Posts: 1153
Nickname: matt
Registered: Feb, 2002

Re: Announcing Head First Design Patterns Posted: Nov 14, 2004 10:48 PM
Reply to this message Reply
Wow, and you guys even got Gwen Stefani on the cover of your book!? That sure beats the ridiculous covers on the Wrox books.

Also, maybe you get get a chapter into Artima's chapters library: http://www.artima.com/chapters

Ravi Venkataraman

Posts: 80
Nickname: raviv
Registered: Sep, 2004

Re: Announcing Head First Design Patterns Posted: Nov 16, 2004 9:54 AM
Reply to this message Reply
I read the chapter at the O'Reilly website.

Very nice way of explaining things. I like the conversational tone of explanation, mainly because it enlivens the exchange. To the reader it almost seems as if he is having a conversation with the author.

The following is only with reference to Chapter 3 of the book available at the O'Reilly website.

I do have something to say about the use of the Decorator pattern. I feel that even with the Decorator pattern, there are far too many classes. Also, addition of a new Beverage requires adding a lot of code. Adding new features such as discounts and sizes to the problem is non-trivial. There is a lot of repetitive code.

Let us look at the problem from a user perspective, the person behind the counter who is taking orders. Here is what I think happens.
A customer walks in and says, for example, "I want a House Blend with mocha." The cashier enters the information and expects a price to appear on the screen.

The information needed by the system for calculating the price are:
1. The name of a beverage (House Blend, decaf, etc.), and its size.
2. The names of zero or more condiments.
3. The discounts applicable to the beverage.

This leads me to a process/class called "MakeBrew" that has all this information and is able to accept the information and calculate a cost.

Starting with a top-down (XP practitioners faint in horror here!) user-centric design I'd create a Brew class that accepts an instance of a Beverage Class and a BeverageSize (possibly an Enumeration). We add Condiment[s] to it, and then calculate the cost. Beverage Discounts can be applied at the end. The cost, of course, depends on the BeverageSize.

This leads us to a list of classes: Brew, Beverage, BeverageSize, BeverageDiscount and Condiment.

Looking at the Beverage class, the question arises about whether we should create sub-classes for Espresso, Decaf, etc. Creating sub-classes does help. But a deeper look at the various possible subclasses show that the key feature is that each Beverage has a description, size, cost and a discount.

We can create sub-classes for each Beverage. But if a new Beverage is added, we need to create a new sub-class, having the same attributes as all other sub-classes of Beverage. Is there an alternative?

Given that the only differences between beverages are the values of various attributes such as cost, discount, etc., I prefer a "data-driven" approach, where we can pick up the information from a data source (XML file, properties file, text file, or a database). This data source is used to create all instances of the Beverage class. The Brew class uses instances of these pre-created Beverages, adds Condiment[s] (defined similar to Beverage, with no sub-classes and instances obtained from a data source), and then computes the cost based on the size and applicable discounts.

The advantage of this design is that, adding a new Beverage simply means adding new data to the data source. No code change or addition is needed to add a new Beverage.

Likewise, adding a new Condiment is simply a matter of adding data, requiring no code changes. Changing the cost of a beverage or a condiment is simple, requiring no code change.

In essence, what we see is that a different design requires no inheritance at all, and is simpler and easier to maintain and enhance.
Incidentally, in this particular example there is no need for the decorator pattern and its sub-classes.

When reading the chapter, I saw the requirement that the Decorator class have the same interface as the Beverage class as a sign that an alternative ought to be available. From a design perspective, a decorator should be using composition, not inheritance, to add behaviour. The Brew class described here serves the same purpose as the Decorator class, uses composition, enforces the restriction that there must be exactly one Beverage in the Brew (the only constructor requires a Beverage and BeverageSize), and makes it easy to add discounts or account for size. The decorator pattern forces the developer/designer to create sub-classes of the Decorator class, yet makes it difficult to add meaningful functionality. (Adding a new size would require adding the size to all the sub-classes, repetitive work that is not aesthetically pleasing.)

In general, I find that I seldom use inheritance in my OO work.

If anybody is interested, I can post the source code for the example.

Vance Arocho

Posts: 5
Nickname: aroc725
Registered: Jun, 2003

Re: Announcing Head First Design Patterns Posted: Nov 17, 2004 6:33 AM
Reply to this message Reply
Ravi, I agree with your approach. As you said/wrote,

"Given that the only differences between beverages are the values of various attributes such as cost, discount, etc."

and there are no differences in *behavior* between different beverages (what behavior does a beverage have, anyway?), there doesn't seem to be a compelling need to create an inheritance hierarchy of super- and sub-classes.

Juan Garcia

Posts: 1
Nickname: ingegarcia
Registered: Nov, 2004

Re: Announcing Head First Design Patterns Posted: Nov 22, 2004 10:29 AM
Reply to this message Reply
I have heard a lot of wonderfull thinks about the book, but before I buy it I would like to get a list of the patterns explained in this book, can somebody help me with it.

Vance Arocho

Posts: 5
Nickname: aroc725
Registered: Jun, 2003

Re: Announcing Head First Design Patterns Posted: Nov 22, 2004 11:13 AM
Reply to this message Reply
The following excerpt, found at

http://www.oreilly.com/catalog/hfdesignpat/desc.html

might help:

"Most importantly, you want to learn the "secret language" of Design Patterns so that you can hold your own with your co-worker (and impress cocktail party guests) when he casually mentions his stunningly clever use of Command, Facade, Proxy, and Factory in between sips of a martini. You'll easily counter with your deep understanding of why Singleton isn't as simple as it sounds, how the Factory is so often misunderstood, or on the real relationship between Decorator, Facade and Adapter."

(Bolded pattern names courtesy of yours truly)

Lynn V. Marentette

Posts: 1
Nickname: lynnvm
Registered: Jan, 2005

Re: Announcing Head First Design Patterns Posted: Jan 20, 2005 3:54 PM
Reply to this message Reply
Hi. I'm a mid-career school psychologist, new to programming. I bought the "Head First Design Patterns" book the other day. I'm a visual learner, so I really have enjoyed it so far!

I recently finished a VB.Net class. Our textbook was written by Diane Zak, and I had the hardest time getting through all of the readings. I'm planning on taking a Java programming class next summer, when I am off from work and can devote my entire attention to programming. I think that the Head First Design Patterns book will really help me prepare for what lies ahead.

I e-mailed my computer teachers information about the book and they were impressed. I've taught college classes before (psychology, NOT computers), and I know how hard it is to find good resources for busy students.

I joined this forum to learn more about programming.

sheir ali

Posts: 1
Nickname: nrc11464
Registered: Mar, 2016

Re: Announcing Head First Design Patterns Posted: Mar 3, 2016 11:37 AM
Reply to this message Reply
Hi,
I know this post is old but just came across it via google.

I would like a copy of the source code example.

Thanks.

Flat View: This topic has 9 replies on 1 page
Topic: ScalaTest 3.0.0-M11 Released Previous Topic   Next Topic Topic: What is

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use