Design Patterns

From Slashdot – ‘Design Patterns’ Receives ACM SIGPLAN Award

There is a useful website on Patterns and OOD/OOP at http://ootips.org/

worth it for one reason (Score:5, Informative)
by bmac (51623) on Saturday July 30, @10:10PM (#13205261)
(Last Journal: Friday March 26, @05:49AM)

The patterns themselves are not really that groundbreaking, IMO; the genius of the book is the perspective on looking at software as pattern definitions and then their use in different ways and places in software.

The part that every OO developer should ingrain in their brain is to

Prefer composition to inheritance.

Good Lord, people love their inheritance when there are very, very rare situations that call for it. (Composition, btw, is where a data structure is used as a data member of the class).

What it recommends is that instead of this:

class cElement : cParent { ... }

use this:

class cElement {
      cParent mParent; ...
}

Inheritance is so friggin abused by OO developers, it is ridiculous.

So, my recommendation is to read the first 50 pages or so, which is their general perspective on programming. After that, it’s just details about the patterns they have encountered in their careers.

Peace & Blessings,
bmac

An observation… (Score:5, Insightful)
by bunyip (17018) on Saturday July 30, @10:14PM (#13205279)

“Some is good, more is better, and too much is just about right.”

– This mantra is good for money, horsepower, disk space, but not design patterns…

When somebody starts telling me that they used 5 different patterns in their program and they’re proud of it – then I know the code is crap. Most of the pattern zealots I’ve seen write bloated, inefficient code. Sometimes I think they scour the literature looking for some extra patterns to put in.

That said, these patterns do exist and programmers keep reinventing them. The key is knowing when to call it a pattern and go to the trouble of formalizing it versus just writing code. Alternatively, find a language that makes most of these go away.

Easily mastering design patterns (Score:5, Informative)
by De Lemming (227104) on Saturday July 30, @10:43PM (#13205372)
(http://www.lemming.be/)

The classic Design Patterns book is great, and the GOF certainly deserves this award. Still, the book is hard to read. And in daily practice, it’s not always clear when to apply which pattern (especially for the less experienced).

I’m reading Head First Design Patterns [amazon.co.uk], published by O’Reilly, right now. It’s an fun and easy to read Design Patterns course, which is difficult to put down once you started it. The authors have a great sense of humour, and use a very practice-oriented approach. They tackle day-to-day problems by starting with the obvious solution an inexperienced programmer would use. Then they point out the problems with this solution, and step by step they work to the appropriate design pattern. Patterns are examined from different viewpoints, and the authors try to answer all the questions you might have.

I really recommend this book. In fact, I recommend the whole “Head First” series (I also own Head First EJB). These books are not usable as reference works, but they are wonderful for learning and mastering a subject.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Comments are closed.