Want to read Slashdot from your mobile device? Point it at m.slashdot.org and keep reading!

 



Forgot your password?
typodupeerror
×
Programming Books Media Book Reviews IT Technology

Design Patterns 314

BShive writes "Design Patterns is considered a classic for anyone in software development. The beginning third of the book is a solid introduction to patterns, while the last two thirds of the book is devoted to the patterns themselves. Many of the professionals out there probably already own a well-used copy of this book, but there are others who are wondering what all the fuss is about. The frequency of hearing about this text in discussions piqued my interest enough to buy it for myself. If you are interested in design patterns and are looking to use them, then this should be one of the books on your shelf." Read on for more.
Design Patterns
author Erich Gamma, et al
pages 395
publisher Addison-Wesley
rating 8
reviewer Ben Shive
ISBN 0201633612
summary Design Patterns is considered a classic for anyone in software development. Many of the professionals out there probably already own a well-used copy of this book, but there are others who are wondering what all the fuss is about.

Introduction

I found the entire introductory section excellent, and a good read. It covers what design patterns are and explains how they are documented and categorized. Advice on where and how to employ design patterns to achieve reusable and flexible software is also covered to give you an expectation of what you can get out of the rest of the book. The What, Why, and How are covered nicely. Even with little previous exposure to patterns, I was able to understand the presented material easily and begin to see the applications.
Object Modeling Technique (OMT) notation is also introduced to explain the diagrams associated with the patterns and examples. If you have used UML, the diagrams and notations will be familiar to you since UML is influenced by OMT. Jim Rumbaugh, the creator of OMT, collaborated with Grady Booch to create the first version of UML.

As the author notes, having a solid knowledge of OOP is critical to being able to understand and use the information presented. If you don't fully understand OOP, pick up an introductory text first. An Introduction to Object-Oriented Programming by Timothy A. Budd or any similar book will get you up to speed. However, you will get the most out of Design Patterns with hands-on OOP experience.

Case Study

This chapter presents a case study in designing a WYSIWYG document editor to demonstrate how design patterns can be applied. Most of the examples in the book involve the user interface and I would have liked to see less emphasis on UI models. However, it still gives the reader insight into real applications of patterns. Not only do the authors point out how the pattern applies to each case, but they also present the problems associated with the application. The case study is not intended to set up a perfect example of pattern usage, but to explore it. The reader could go further with the design presented and think about how to solve the flaws pointed out along with the ones that have not been discussed. I liked the fact that they do not attempt to state that there is only one way to solve the problems presented, or that their solutions are even the best way. Too many authors fall into this trap.

Presenting: The Patterns

The three chapters on patterns make up the bulk of the book. The patterns are separated out into the three chapters by type: Creational, Structural, and Behavioral. Each chapter begins with an overview of what the patterns of the type can be used for, and how the chapter deals with the patterns as a group. At the end of each chapter there is a discussion section that summarizes the patterns, along with guidance on how to select the right one from the chapter.

Each pattern description contains a number of sections: Intent, Also Known As, Motivation, Applicability, Structure (in OMT), Participants, Collaborations, Consequences, Implementation, Sample Code, Known Uses, and Related Patterns. The breakdown makes it easy to determine if, why, and how you should use the pattern. The authors are justifiably concerned about using the wrong pattern for a given situation. The code snippets are also easy to work through as long as you know an OOP language. C++ is commonly used, with the occasional bit of Smalltalk code.

The three chapters that detail each pattern would be difficult to read right through. However, the opening and closing section of each chapter has valuable information and is worth reading and subsequently referring to some of the patterns discussed. I got the most out of these chapters by picking patterns that might apply to current projects I was working with and then exploring one in depth, branching over into other patterns in a non-linear fashion.

Conclusion

The closing chapter is relatively short, but makes some important points. The authors discuss what to expect from design patterns, some history and other references/influences. Re-factoring is discussed and how patterns will help mitigate this unavoidable process as the software evolves. Other benefits are also brought up briefly. The book closes with an invitation to give the authors feedback and to find patterns that you use. The best designs will use many design patterns that dovetail and intertwine to produce a greater whole.

Book Extras

The whole book has a quality feel to it that is missing from many current texts that cost nearly twice as much. Inside the front cover there is a quick reference to all of the patterns contained in the book with a brief description and page number. The back cover also contains a quick reference for diagram notation and the relationships between the design patters. This is all topped off by two bookmark ribbons attached to the spine.

The Age Issue

Design Patterns was originally published in 1995, and the book mentions that the patterns it contains are little changed from 1992! In the computer field this would be considered an ancient text with how fast software is updated and languages change. Despite this, since the material is not entirely dependent on a particular language or program it holds up quite well. The examples referred to for each pattern are older software that many will not recognize. An updated version would be nice, but being old does not condemn this book to being useless.

Summary

This is an excellent book even if it is beginning to show its age. The fact that it's still very useful is testimony to the quality of the material. A few readers might find the reading to be a bit dry, but the straightforward style was refreshing compared to some other texts. The authors stay focused on the topic and condense it appropriately without going off onto long tangents. Once I've followed through with applying some patterns to projects it might garner an even higher rating. Just from reading about some of the patterns, I could see how they could have applied to previous projects I've worked on, both large and small. The book was certainly a worthwhile investment. If a second version of this book ever comes out, I'd be sure to pick it up as well.

Chapters:


1. Introduction
2. A Case Study: Designing a Document Editor
3. Creational Patterns
4. Structural Patterns
5. Behavioral Patterns
6. Conclusion

Appendix:
A. Glossary
B. Guide to Notation
C. Foundation Classes


You can purchase Design Patterns from bn.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.

This discussion has been archived. No new comments can be posted.

Design Patterns

Comments Filter:
  • by StefMeister ( 219044 ) on Tuesday November 05, 2002 @11:34AM (#4599539)
    For a second there I thought it said designing patents. I guess that's what happens when you spend more time reading /. than doing your actual programming work. :)

  • by CatWrangler ( 622292 ) on Tuesday November 05, 2002 @11:39AM (#4599566) Journal
    I have never seen a code monkey in a well designed patterned outfit. I wonder if this book will help at all.
  • by GeekLife.com ( 84577 ) on Tuesday November 05, 2002 @11:39AM (#4599571) Homepage
    Can we get a review of this site, slashdot.org I've heard so much about?

    Sorry, I'd just thought everyone had heard about Design Patterns long ago. Seems a bit like publishing a book review on the KJV Bible or something.
  • by Waffle Iron ( 339739 ) on Tuesday November 05, 2002 @12:06PM (#4599745)
    Book learnin' is fine and all, but here are some design patterns from the real world:

    The Demo design pattern:
    Boss: We need to have a working demo by the trade show next month.
    Developer: OK, but it's just going to be a barely working hack. There's no time to do any proper design by the show. It's going to push back the ship date because we're going to have to rip out the kludges and redo them properly.
    Boss: Fine. Just get me that demo.

    The Ship date design pattern:
    Boss: We need to ship the product by the middle of next quarter.
    Developer: We don't have time to fix the demo hacks by then. We need more time to do a proper design. I told you that the ship date would be pushed back by the demo.
    Boss: Everybody saw it working at the show, and they wonder why they can't have it now. We have to go with whatever you've got.

    The Beeper Design pattern:
    Boss: Support has been getting a lot of calls from customers in the field. A lot of random crashes. We need to have a developer available 24x7 to help debug these problems. Here, take this beeper.
    Developer: I told you so.
    Boss: We need to get a demo of version 2.0 by the field sales seminar next month.
    Developer: Aaarrghhh!

  • by russellh ( 547685 ) on Tuesday November 05, 2002 @12:48PM (#4600097) Homepage
    Yeah. Mere coders shouldn't be reading books like this, lest they risk being distracted by a glimpse the big picture.
  • by Anonymous Coward on Tuesday November 05, 2002 @12:50PM (#4600107)
    Mmm, you want a summary of the KJV? That's not hard... :)

    Well, it all starts when God makes the universe in a week or so, then this guy, Adam eats an apple because his wife, Eve told him to, then they get kicked out of this garden & have a bunch of kids. Then the kids kill each other (literally), get cursed, form a bunch of nations which war with each other & junk.

    Then, this guy Abraham sacrifices his son, Isaac, only he doesn't. So they sacrifice this goat who got stuck in this bush, instead. Then Isaac has a son, Jacob who sees a ladder to Heaven & wrestles with the Angel of the Lord, and no, I'm not pulling your leg ;) Jacob also manages to get his father's blessing instead of his brother, Esau. Jacob's son, Joseph then makes his brothers jealous, so they sell him into slavery, but he becomes the Pharoah's assistant & saves them all from famine. So he gets the double portion of the eldest son (instead of Reuben, who was the eldest), and we wind up with the 12 tribes of Israel from all the sons of Jacob--namely: Joseph, Reuben, Simeon, Levi, Judah, Issachar, Zebulun, Benjamin, Dan, Naphtali, Gad & Asher. So all of them live in Egypt now & eventually wind up as slaves.

    Then this other guy, Moses is born. He's really beautiful (for a baby) so they throw him in the river in a basket so he won't get killed (because those Egyptians wanted to kill all the Israeli babies so they wouldn't be a threat to them). Anyhow, he gets raised by the Pharoah's daughter, but later talks to a burning bush (God) & decides to free all his brothers from Egypt. So he unleashes a bunch of plagues (10 of them; see Exodus 7:11) until they've had enough & he gets all the people to leave there quickly--so quickly they don't have time to let their bread rise (hence, it's unleavened).

    So then they run away, part the Red Sea, drowning all the Egyptians who tried to follow them & get their slaves back by flooding the sea behind them. Then Moses goes up this mountain (Mt. Zion), talks a bit more with God & gets 10 commandments. In the mean time, the people decide that they want to worship someone else, so they make some golden calves. Moses comes back, gets mad, smashes the 2 stone tablets he had, grinds up the idols they made & makes them drink that in their water and stuff. Moses then gets things (more or less) in order & gets some new tablets & detailed instructions on how to build a tent (Tabernacle) for the Lord which is *really* fancy and they go wander around for quite a while, eating manna (which means "what is it?"). Some people at some point decide to challenge Moses for leadership (they figure they could find their way out of the desert in less than 40 years, or something?) but they lose & get swallowed up in a fissure from an earthquake or something. So they wander around for 40 years until the people who didn't think they could do it are all dead & the next generation then storms into the "Promised Land" and takes it over (again--their great grandparents had that land before, but others took it over while they were in Egypt).

    Then things are okay for a while, except that they're at war with a bunch of the other people around there. So God sends in a bunch of judges who do stuff. One of them had 40 sons who had 40 camels! Another one (Samson) beat up a bunch of people with a donkey's jawbone until they tricked him into cutting his hair. He got his revenge on them, though, by knocking down one of their temples when he was an old man & had been a prisoner of them for a long time (they had even put his eyes out!)

    Well, the judges didn't work too well, so the people asked for a king. God didn't like that idea, but gave them Saul anyhow. He didn't work out though & lost a battle he wasn't supposed to be in and so David took over. David did great, except that he had an affair with someone he saw taking a bath from the palace roof (Bathsheba). So he killed off her husband so he wouldn't complain. God didn't like this very much, however. Eventually, he had a son by her named Solomon who was very wise & succeeded him as king. Solomon did great as king (they actually had peace for a while!). He also built God a temple (David had wanted to do that, but God didn't let him because he'd been in too many wars). Solomon's son wasn't half as bright, though & wound up splitting them into Israel & Judah. Israel was 10 tribes, while Judah was only 2 and so Solomon's son now had 1/6 the kingdom he had before.

    After this, both halves have a whole bunch of bad kings who do bad things & a few good ones. God also sent a whole bunch of prophets, but people mostly ignored them. Eventually, God got sick of this & sent them all into exile in Babylon. Eventually, though, they got free again for a while & rebuilt God's temple with the help of some folks like Zerubabel (who also had a curse lifted off his family). Anyhow, the prophets did a lot of fun things in this time; one of them got swallowed by a whale (Jonah) and was distressed to see that the Ninevahites were more penitent than Isreal. Another guy saw a statue of gold, silver, bronze, iron & clay. There was also a bunch of other visions like the one with the fiery wheels (Ezekiel).

    Then we skip a bit of history in the Bible in what's called the "intertestamental period." There are books & stuff from this time, but not many are cannonical, at least, not to Protestants. The Catholics still read Maccabees & such (the KJV people *did* translate the apocrypha/deuterocannon, BTW, but some other folks decided they didn't like those books because they contained too much dogma or something, so they stopped printing them in Protestant bibles). In there, we find out that the Jews go into exile again at the hand of the greco-roman empire. They actually rebel successfully for a while (thanks to Judas Macabee) but then get crushed again. After this time, while they're still under Roman rule, this guy name Jesus, who is the Messiah is born.

    Anyhow, this Jesus guy escapes getting killed as an infant (not unlike Moses did), learns stuff from the priests in the 2nd Temple (first was destroyed, you remember), does a bunch of miracles & eventually makes the Pharisees jealous enough to put the Romans up to crucifying Him. Fortunately, Jesus had chosen 12 disciples (though one of them, Judas, betrayed Him) and so the 11 good ones & the extra guy they appointed later (Mathias?) carry on the good work after they find out that Jesus got ressurected.

    So they go all around, preaching the good news & driving Pharisees to distraction, including one guy named Saul who was really mad at them. But then Jesus tells Saul to quit it in a vision on the road to Damascus, so Saul does, gets baptised & changes his name to Paul, then goes on to write most of the NT. So they go on all kinds of missionary journies, heal people & stuff until Paul gets sent to Rome because after he created a fuss, he appealed his case to Caesar, as was his right as a Roman citizen. Of course, Caesar had him executed, but we don't really get to that part in the Bible itself; we hear no more of him after he goes to Rome. Also, this guy named John has this really long, cool, vision from God about Jesus coming back again & stuff which we call the book of Revelation.

    That pretty much sums it up for the Bible itself, though after this time was interesting, too. After revolts starting in 67 AD or so, the Romans smash the 2nd Temple (in 70 AD) and after a bunch more conflicts, they finally subjugate the Jews. The Christians (who were first called that in Antioch), OTOH, get martyred a lot, until they convert an emperor & pretty much take over the Roman empire, though it ceases to be a world power not so very long after that. The Jews get dispursed & the Christians have control of the Holy Land for a while, until this guy named Mohammad from Medina shows up, claims to have a message from God & tells his own story, completely unlike the one in the Bible. So he goes about raiding caravans & such, while trying to get rid of all the polytheists (infidels) in the area & eventually establishes Mecca as the capital of Islam with this really cool black rock thingy as a monument. He tells his followers to make sure they don't lose the original Koran, too, since he didn't like the fact that we had tons and tons of copies of the Biblical manuscripts, but no one knew of the originals (probably got lost in one of the exiles). Anyhow, eventually, a bunch of Moslems take over the Holy Land (they consider it holy too, after all), they get access to all the learning & technology of the ancient greeks & drive the Christians out of the area. So they undergo their own sort of Renaisannce, while the Christians have the Dark Ages. Then somebody gets the bright idea to take the Holy Land back from them, so they start the Crusades over many centuries and fight a lot. In addition to killing a lot of people & stuff, they find some of the learning of the Arabs & so they absorb it & eventually leave the Dark Ages & have their own Renaissance, the Age of Exploration & all kinds of other stuff which leads up to the world you know today :)

    So, that's my review of the Bible & the last two millenia or so :)
  • by jgoral ( 623118 ) on Tuesday November 05, 2002 @01:05PM (#4600198)
    The single sentence in the middle of page 18 alone is worth you mony.

If you have a procedure with 10 parameters, you probably missed some.

Working...