Applying UML and Patterns

Craig Larman

Mentioned 7

Master the Unified Modeling Language, the new standard for object orientation. It's not enough just to learn an object-oriented language. A proficient programmer must also have the ability to design robust, scalable, maintainable systems. Applying UML and Patterns was written especially to provide the foundation for a complete understanding of the object paradigm, and how to put it to practical use. "Applying UML and Patterns" provides beginning object programmers with a detailed activity roadmap to guide them through each step of requirements, analysis, design, and coding. This book strongly emphasizes translating theoretical concepts to practical applications, including: Mapping object-oriented diagrams directly to Java code Expressing models using UML Integrating patterns for analysis and design Creating layered architectures Building frameworks Using a single integrated case study throughout the book, "Applying UML and Patterns" provides a comprehensive, hands-on approach that gives a thorough grounding to beginning and intermediate programmers. This book is also available as part of Applying UML and Patterns - The Complete Video Course (ISBN: 0-13-025559-9).

More on Amazon.com

Mentioned in questions and answers.

I'm a confused newbie and hobbyist programmer trying to get a grip on this, so forgive me if my question is a little off or doesn't make much sense.

I see a lot of questions on SO revolving around the use of design patterns, and I'm wondering if anyone has a good resources for learning about, and implementing design patterns? I understand the general idea, and know how/when to use a couple of them(Singletons, Factory methods) but I know I'm missing out.

(Just in case it matters, my language of preference is C# but I could learn from examples in other languages)

Applying UML and Patterns by Craig Larman. Start from the basic of analysis, design and uses a simple Case scenario. Introduces most of the basic patterns in a simple way.

An introductory book that I found useful and well written is Design Patterns Explained by Alan Shalloway and James Trott (Addison Wesley).

alt text

Do not start from the Gang of Four book, for it is not an introductory book by any means.

The original Design Patterns book is a must-read for all programmers.

It is an excellent book on every level: layout, clarity, insight, depth. It's one of those great books that you first read cover-to-cover, and then use as a reference until you literally know it inside out.

You could start by the Wikipedia page, but treat yourself with the great book too.

Design patterns are great for various reasons:

  1. gives you a starting for solving common problems.
  2. gives developers a vocabulary to talk about certain ways of solving problems in a very compact manner.
  3. when working with developers who know design patterns and you use design patterns in your solutions they will understand the solutions a lot faster.

But when your goal is just to learn design patterns I think you are missing the fundamentals. All design patterns are based on more common principles. High Cohesion, Low Coupling Open Closed Principle, DRY, Liskov Substitution Principle etc. For these fundamentals I would read the following books in this order:

  1. Head First Object-Oriented Analysis and Design (Head First) [ILLUSTRATED] (Paperback)
  2. Applying UML and Patterns (Hardcover)
  3. Agile Principles, Patterns, and Practices in C# (Robert C. Martin Series) (Hardcover)

After that you are ready for the basic gang of four design patterns

  1. Head First Design Patterns (Head First) [ILLUSTRATED] (Paperback)
  2. The BIBLE
  3. A nice website (don't buy anything, it is not worth it) http://dofactory.com/Patterns/Patterns.aspx (some implementations of this site are worth a discussion

The next step:

  1. Patterns of Enterprise Application Architecture (Addison-Wesley Signature Series) (Hardcover)
  2. The POSA books

And always remember : the pattern is not the goal !

Before spending money on books I would recommend Wikipedia's excellent design patterns page. Also for something different Google for "design pattern screencasts" or search for "design patterns" on YouTube. Getting the same information presented differently often helps the penny drop.

The Gang of Four book is the definitive text on the most well known patterns but is not that easy to read and with C++ examples not everyone's favourite.

The Head First Design Patterns text is far more accessible but only contains a subset of the Gang of Four patterns.

The most important thing is to understand where and why a particular pattern is useful. Afterwards search the web for implementation examples in the language of your choice and experiment until you "get it". Understand one pattern before moving on to the next. Everyone understands some patterns better than others (and there are hundreds of lesser known ones).

Just keep plugging away.

Head First Design Patterns

alt text

and the Design Pattern Wikipedia page are the best resources for beginners. FluffyCat is another good, free online resource for design patterns in both Java and PHP.

The Gang of Four book is where to go afterward, but it's fairly advanced, so I'd wait until you have a pretty firm grasp from the other resources.

I'd add that Design Patterns book from the "Gang of four" is a bible for anyone who is seriously interested in design patterns.

I am on the quest to be a good OO-developer. OO intrigues me, because I understand the patterns, know why composition gives you more flexibility then inheritance, and more of such wisdom. However, I came to the conclusion that I know how to implement a factory of a singleton, but that I do not know how to come up with a robust OO design.

I have a bunch of books

  1. Design Patterns by the GoF
  2. AntiPatterns Brown et al.
  3. Refactoring by Fowler
  4. Code complete 2

They might be very good books, but they don't teach you to architect an application. I am often paralysed by some very basic decisions (example). I am looking for a book that teaches the when and why. There are many books about hammers and nails, but I have yet to find a book that tells you something about their practical relationship.

What book was most instrumental in making you a confident OO-architect/designer?

  1. "Object-oriented software construction" by Bertrand Meyer

Most fundamental work about object-orientation ever published. This is absolutely must have book for every "object-oriented" programmmer.

2. "Object-Oriented Analysis and Design with Applications" by Grady Booch et al

Not so formal as Meyer's book, but this book can open your eyes on many questions in object-oriented world and in software development in general

3. "Design Patterns: Elements of Reusable Object-Oriented Software" by Erich Gamma et al.

This is famous "Gang of Four" book about design patterns

4. "Refactoring: Improving the Design of Existing Code" by Martin Fowler et al.

This is another classical book. First part perfectly describe many problem that modern software developer may faced during his work: code smells, readability vs performance, premature optimization drawbacks and many other topics.

5. "Thinking in Java" by Bruce Eckel

This book may help many beginners not only in Java language but in object-oriented way of thinking too.

6. "Touch of Class: Learning to Program Well with Objects and Contracts" by Bertrand Meyer

Excellent textbook by famous author.

Craig Larman's Applying UML and Patterns summarized a lot about what I had learned from experience. What I like about it is that it addresses all the aspects of software design -- which includes things like iterative design and development. Don't stare too hard at the use of UML: design descriptions are a means towards an end, and I found Larman's approach fairly pragmatic. You can't just code: you have to communicate your intentions (and understand what is needed). UML and cleanly designed, well commented code are some of the means towards that end.

And, of course, as others mention: no book will make you a good developer or designer. But it might help accelerate the process.

I am looking for good resources (books/web sites) for learning object oriented design. Every resource that I find are tutoring me more on UML and RUP instead of OO design. Head first book's sheer repetition is making me not want to read any of their books. I am looking for a book similar to "Structure and interpretation of computer programs" for object oriented design that gets to the point of teaching OO. I have no preference for any specific OO laguage.

Also as replacement for the Gang of Four book.

I can recommend: The Design Patterns Smalltalk Companion

In general learning Smalltalk will help you to be a better OOP Developer on any language.

From the Amazon reviews:

Easier to understand than the original GoF, February 4, 2000 By Nicolas Weidmann
This book gives you a better understanding of the patterns than in its original version (the GoF one). I am not a SmallTalk programmer but a 9 years C++ one. At work I had to use the GoF book and never liked reading it. In contrast to this, the SmallTalk companion is easy to read and you can understand the patterns within the first few lines of their description. Take the Bridge pattern and compare their discussions in the two books. If you really like the Gof one then buy it. But according to me, it would be a big mistake buying the GoF in favour of the SmallTalk companion. Trust a C++ programmer :-)

Object-Oriented Analysis and Design with Applications by Grady Booch is the bible for this topic. It is also very approachable though somewhat dense at points, but definitely worth reading and re-reading.

Quoting myself from another answer on the same topic:

Great resources to learn how to think in patterns and do correct OOP analysis and design are Analysis Patterns: Reusable Object Models by Martin Fowler and Applying UML and Patterns by Craig Larman. Also I need to mention here Domain-Driven Design: Tackling Complexity in the Heart of Software by Eric Evans, the most valuable book I found to think about the whole software design process.

Can someone send me an article or a book where i can find how to use design patterns inside UML class diagrams? Extra points for references having a case study and a summary about how to use design patterns throughout the UML class diagram.

What is the simplest way to use database persistence in Java? I know, many frameworks exists around the Internet, but it could be fun to learn how to develop a persistence layer by myself and its design patterns. Where to start? Books, websites, how-tos, code-examples, etc.

If you are looking for a learning practice then try to get a copy of Craig Larman's Applying UML and Patterns.

alt text

There Larman presents a chapter on lightweight database persistence mapper design. Unlike Hibernate, which is based on an unobtrusive persistence model, he presents an obtrusive framework in which domain objects has to be extended from a PersistentObject. We also have to write mapper classes for each persistent domain class. Its some sort of ActiveRecord pattern without any codegeneration concept.

I found this book to be particularly useful. This is a good one too.

Having created one myself I agree - it is a lot of fun, and a lot of work too. It all depends on your objectives.

This book (Patterns of Enterprise Application Architecture) seems very good at first sight. I have look into it, and design patterns for developing a persistence engine are very comprehensive. It tells why, when and how to use them.

i'm doing a system these days, my first one actually and i'm in trouble doing OOAD, i need some help from you all, i'm familiar with diagrams drawn in UML,but when given a scenario i can't make a link, can't see a flow of them, for example now i'm designing the system, i've done use case diagrams and activity diagrams and now i'm finding it very difficult to decide the classes according to the situation? i can't find a flow between these diagrams, how can i get class diagrams when i'm done with the above mentioned two diagrams? i'm not that much expert in UML either,just familiar with the diagrams? can some one solve the problem? any suggestion of tutorials? how to analyse a system? what is the problem with me??

regards, Rangana

If you feel like that, don't start with UML. Start with the code itself. Moving from requirements to design is always an intuitive leap, which gets much easier with experience (including the experience of making major mistakes, alas!). There are any number of books that can help you progress faster, but nothing beats actual coding experience to drive your design skills. Skip the class diagrams for now, and focus on the code: class diagrams are just a way of abstracting away details in order to communicate the overall shape of your program, sometimes to yourself! If you're unsure of the details, don't attempt to hide from them...

I'd recommend Craig Larman's Applying UML and Patterns as a starting point addressing most of the software design lifecycle, from a fairly practical and integrated perspective. There are plenty of other books out there: check SO for questions on e.g. general programming books and OO books.