Which book?

I'm currently reading Core J2EE Patterns to try and improve my design skills. It's my first real introduction to patterns, and the first 150 or so pages were an okay read.

When it gets into the pattern section there are a lot of references to other patterns, not covered in the book, which are used to explain the J2EE patterns. This makes it a little hard to follow.

So I wanna buy a book but I'm not sure which one would be best, I'd rather one written in a java context, but the GoF book is mentioned a lot and hailed as a "classic" so what book would people say is best? The three candidates are:

Design Patterns - GoF

Design Patterns Explained - Allan Shalloway, James R. Trott

Head First Design Patterns - O'Reilly

Maybe there are better ones available? Any help on this would be appreciated.

[847 byte] By [Jimmkirka] at [2007-10-2 22:10:33]
# 1

> I'm currently reading Core J2EE Patterns to try and

> improve my design skills. It's my first real

> introduction to patterns, and the first 150 or so

> pages were an okay read.

That should not be your first patterns read. It should be "Design Patterns" by the Gang of Four.

"Core J2EE" is okay, but a lot of it sprung up to paper over problems with EJBs. I think some of them are considered anti-patterns now. (Just my opinion, of course.)

> When it gets into the pattern section there are a lot

> of references to other patterns, not covered in the

> book, which are used to explain the J2EE patterns.

> This makes it a little hard to follow.

>

> So I wanna buy a book but I'm not sure which one

> would be best, I'd rather one written in a java

> context, but the GoF book is mentioned a lot and

> hailed as a "classic" so what book would people say

> is best? The three candidates are:

>

> Design Patterns - GoF

This is the first and best, but the examples are in Smalltalk and C++. (Java wasn't around when it was written.)

> Design Patterns Explained - Allan Shalloway, James R. Trott

Haven't read it.

> Head First Design Patterns - O'Reilly

The "Head First" books are pretty good. A good companion to GoF.

> Maybe there are better ones available? Any help on

> this would be appreciated.

The GoF book is your best bet. The catalog is online, I believe.

I'd also recommend Martin Fowler's "Patterns Of Enterprise Application Architecture".

Craig Larman's "UML and Patterns" is supposed to be excellent.

%

duffymoa at 2007-7-14 1:27:23 > top of Java-index,Other Topics,Patterns & OO Design...
# 2
Mark Grand's pattern in java
mchan0a at 2007-7-14 1:27:23 > top of Java-index,Other Topics,Patterns & OO Design...
# 3
Thanks for the replies. I've read some reviews and I think I'll go with the head first one, because I'd prefer a java centric view of things. I think I'll invest in the GoF book at some point though just to see what the fuss is about.
Jimmkirka at 2007-7-14 1:27:23 > top of Java-index,Other Topics,Patterns & OO Design...
# 4

> Craig Larman's "UML and Patterns" is supposed to be excellent.

Except for at the end of the book where Larman goes way over the edge

by suggesting to use colours for all those type of lines connecting

classes and whatever. My friend pointed me to that paragraph.

My friend is colour blind ;-)

kind regards,

Jos

JosAHa at 2007-7-14 1:27:23 > top of Java-index,Other Topics,Patterns & OO Design...
# 5

> > Craig Larman's "UML and Patterns" is supposed to be

> excellent.

>

> Except for at the end of the book where Larman goes

> way over the edge

> by suggesting to use colours for all those type of

> lines connecting

> classes and whatever. My friend pointed me to that

> paragraph.

>

> My friend is colour blind ;-)

>

> kind regards,

>

> Jos

oops - I've never read it myself, only hearsay.

Isn't Peter Coad the "color" guy? He likes coloring his UML diagrams - until his mommy takes away his crayons.

Geez, where is Peter Coad these days? Must be off spending the money he got from Borland when they bought TogetherSoft.

There's another product that seems dead. Any poor sods out there still using TogetherJ?

%

duffymoa at 2007-7-14 1:27:23 > top of Java-index,Other Topics,Patterns & OO Design...
# 6

You want to start with Design Patterns by Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides bka Gang of Four.

I have other books, but this is the best with respect to patterns. J2EE patterns are something different from the basic OO patterns. J2EE patterns are sort of a level up. As you have seen the J2EE patterns will be built up with a lot of the basic patterns used in OO design.

The book is not C++ "centric." Any OO book that is centered around a language and not OO is probably violating some OO principles right there. The book is a tough read, but after a few years it starts to sink in. I wish I knew a better one but I sit in the book store reading sometimes and have yet to find a better one.

_dnoyeBa at 2007-7-14 1:27:23 > top of Java-index,Other Topics,Patterns & OO Design...
# 7

> > > Craig Larman's "UML and Patterns" is supposed to be excellent.

> >

> > Except for at the end of the book where Larman goes way over the edge

> > by suggesting to use colours for all those type of lines connecting

> > classes and whatever. My friend pointed me to that paragraph.

> >

> > My friend is colour blind ;-)

> oops - I've never read it myself, only hearsay.

>

> Isn't Peter Coad the "color" guy? He likes coloring his UML

> diagrams - until his mommy takes away his crayons.

>

> Geez, where is Peter Coad these days? Must be off spending the

> money he got from Borland when they bought TogetherSoft.

>

> There's another product that seems dead. Any poor sods out there

> still using TogetherJ?

;-) That reminds me: management is just interested in "user interactions"

because that's basically all they understand. Using UML. a user is usually

depicted as:

O/

<|

/'\

... give or take a bit ;-) Managers claim to understand what 'users' want.

Until I once used a little icon of [url=http://www.zilverendolfijn.nl/zd/zd.pl?a=fc&c=1&kt=NL&s=c&k=JOOPKLEP&f=ss]him[/url], the Dutch loser 'par excellence'

(click on 'Deel 2' (part 2)).

All of a sudden there was a mumbling going on in the audience and someone

asked me who that was supposed to be. "the user" I replied, "the typical

user".

I don't like use cases defined by any form of management ;-)

kind regards,

Jos

JosAHa at 2007-7-14 1:27:23 > top of Java-index,Other Topics,Patterns & OO Design...
# 8
Jos, your user looks like John Travolta dancing in "Saturday Night Fever". 8)%
duffymoa at 2007-7-14 1:27:23 > top of Java-index,Other Topics,Patterns & OO Design...
# 9

> You want to start with Design Patterns by

> Erich Gamma, Richard Helm, Ralph Johnson, and John

> Vlissides bka Gang of Four.

Agreed.

> I have other books, but this is the best with respect

> to patterns. J2EE patterns are something different

> from the basic OO patterns. J2EE patterns are sort

> of a level up. As you have seen the J2EE patterns

> will be built up with a lot of the basic patterns

> used in OO design.

Level up? I disagree. Just a different set of problems to solve. I don't think there's a notion that they're at a higher level.

I would recommend Fowler's "PEAA" over "Core J2EE".

> The book is not C++ "centric." Any OO book that is

> centered around a language and not OO is probably

> violating some OO principles right there.

This is a funny statement. The moment you try to be concrete and present examples, which must be in one language or another, you're not O-O? Let's remember that patterns aren't some sacred constructs that are above implementation. They're codifications of real-life experience in solving real problems.

> The book

> is a tough read, but after a few years it starts to

> sink in. I wish I knew a better one but I sit in the

> book store reading sometimes and have yet to find a

> better one.

You need to read more. It's good to be critical of things, because GoF has had around 11-12 years in the field now. There are a few of those patterns that might be voted off the island if they revisited it today. The idea is a great one, but the 26 patterns aren't holy writ.

GoF has certainly become part of the O-O vocabulary - we all know what Factory and Singleton are because of it. But there are other excellent patterns books out there. PAEE for one; the Buschmann book for another:

http://www.amazon.com/gp/product/0471958697/ref=wl_it_dp/102-0577819-2536135?%5Fencoding=UTF8&colid=D2F70PJMWJYC&coliid=IQR2KUSL6MO38&v=glance&n=283155

%

duffymoa at 2007-7-14 1:27:23 > top of Java-index,Other Topics,Patterns & OO Design...
# 10
> Jos, your user looks like John Travolta dancing in "Saturday Night Fever". 8)Rrrrright! And who's this then: \OO \||> <|kind regards,Jos
JosAHa at 2007-7-14 1:27:23 > top of Java-index,Other Topics,Patterns & OO Design...
# 11

Looking at the reviews for the other books mentioned it seems they all reference the GoF one quite heavily, so I'd probably have the same problem I described in my first post if I don't get the GoF book first. I have some good ideas for follow ons now, so thanks to everyone for the responses.

Jimmkirka at 2007-7-14 1:27:23 > top of Java-index,Other Topics,Patterns & OO Design...
# 12

> > Jos, your user looks like John Travolta dancing in

> "Saturday Night Fever". 8)

>

> Rrrrright! And who's this then:

> \OO

> \||>

> <|

> rds,

>

> Jos

Hmmmm - looks like some UML porn OR perhaps a two-headed Scot doing a Highland Fling.

%

duffymoa at 2007-7-14 1:27:23 > top of Java-index,Other Topics,Patterns & OO Design...
# 13

> > You want to start with Design Patterns by

> > Erich Gamma, Richard Helm, Ralph Johnson, and John

> > Vlissides bka Gang of Four.

>

> Agreed.

>

Not agreed. Excellent reference but not a good tutorial.

It doesn't give any context for example.

> > I have other books, but this is the best with

> respect

> > to patterns. J2EE patterns are something

> different

> > from the basic OO patterns. J2EE patterns are

> sort

> > of a level up. As you have seen the J2EE patterns

> > will be built up with a lot of the basic patterns

> > used in OO design.

>

> Level up? I disagree. Just a different set of

> problems to solve. I don't think there's a notion

> that they're at a higher level.

>

They're more composite patterns.

> I would recommend Fowler's "PEAA" over "Core J2EE".

>

> > The book is not C++ "centric." Any OO book that

> is

> > centered around a language and not OO is probably

> > violating some OO principles right there.

>

> This is a funny statement. The moment you try to be

> concrete and present examples, which must be in one

> language or another, you're not O-O? Let's remember

> that patterns aren't some sacred constructs that are

> above implementation. They're codifications of

> real-life experience in solving real problems.

>

Some patterns have little or no relevance in some languages.

There are a few for example that require multiple inheritance, which makes them irrelevant to Java.

jwentinga at 2007-7-14 1:27:23 > top of Java-index,Other Topics,Patterns & OO Design...
# 14

> Some patterns have little or no relevance in some languages.

> There are a few for example that require multiple inheritance, which

> makes them irrelevant to Java.

Come on, you do know how to do some wrapping and delegation don't you?

kind regards,

Jos

ps. They've pruned the thread, they cut out my answer to my famous UML

impersonation of Dirty Dancing (reply #10)

JosAHa at 2007-7-14 1:27:23 > top of Java-index,Other Topics,Patterns & OO Design...
# 15

I'm placing my vote on the Gang of Four!

Its the original, and still the most thorough book I've ever found on design patterns.

Its the basis from which almost all other patterns are designed.

Also, a lot of times in some books, important details of design patterns are left out, because they are thought to be obvious, etc. I find that the Gang of Four book is the one source that does NOT leave those details out. If you want to understand the patterns inside and out, definitely go with the Gang of Four.

- Adam

guitar_man_Fa at 2007-7-21 8:28:15 > top of Java-index,Other Topics,Patterns & OO Design...
# 16
I've ordered a copy of the GoF book. Hopefully it's as good as everyone says since it's the most expensive ;-)
Jimmkirka at 2007-7-21 8:28:15 > top of Java-index,Other Topics,Patterns & OO Design...
# 17

> Not agreed. Excellent reference but not a good

> tutorial.

> It doesn't give any context for example.

If it's a tutorial the OP is looking for, something like "Head First Design Patterns" might be better.

The value of GoF is the vocabulary it brings. If you look at the Java JDK, it's chock full of patterns. They learned a lot of lessons that were built right into the API.

> They're more composite patterns.

DTO is a composite? Of what? Front controller servlet is a composite? They look atomic to me.

> Some patterns have little or no relevance in some languages.

Please point them out. Decorator? Factory? Composite? Builder? Interpreter? Wrapper? Facade? Mediator? I could go on, but I think you'll find that all those patterns can and are implemented in Java.

> There are a few for example that require multiple

> inheritance, which makes them irrelevant to Java.

Please point them out.

If I go to this site, I see all the GoF patterns. Looks like all of them are implemented in Java:

http://www.patterndepot.com/put/8/JavaPatterns.htm

Java has multiple inheritance - of interface. You just can't have multiple inheritance of implemetation.

%

duffymoa at 2007-7-21 8:28:15 > top of Java-index,Other Topics,Patterns & OO Design...
# 18

> That should not be your first patterns read. It

> should be "Design Patterns" by the Gang of Four.

Agreed. This should be the first pattern book anybody reads.

I would also recomend the Applied Java Patterns book

http://www.sun.com/books/catalog/stelting.xml?section=Preface

> "Core J2EE" is okay, but a lot of it sprung up to

> paper over problems with EJBs. I think some of them

> are considered anti-patterns now. (Just my opinion,

> of course.)

Any pattern can be an anti-pattern if used in-appropriatly.I would say the real anti-pattern of J2ee/EJB is that it is used for projects that don't require _Enterprise_ levels of scalability.

MartinS.a at 2007-7-21 8:28:15 > top of Java-index,Other Topics,Patterns & OO Design...
# 19
http://www.amazon.com/gp/product/159059388X/sr=8-1/qid=1150211670/ref=pd_bbs_1/002-9509711-4347225?%5Fencoding=UTF8
mchan0a at 2007-7-21 8:28:16 > top of Java-index,Other Topics,Patterns & OO Design...
# 20

> Any pattern can be an anti-pattern if used

> in-appropriatly.I would say the real anti-pattern

> of J2ee/EJB is that it is used for projects that

> don't require _Enterprise_ levels of scalability.

Absolutely right, but you'll still see some folks using DTOs even without EJBs. Those are still Java EE apps.

%

duffymoa at 2007-7-21 8:28:16 > top of Java-index,Other Topics,Patterns & OO Design...