O'Reilly logo

Applying UML and Patterns: An Introduction to Object-Oriented Analysis and Design and the Unified Process, Second Edition by Craig Larman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

33.7. Handling Payments with Polymorphism and Do It Myself

One of the common ways to apply polymorphism (and Information Expert) is in the context of what Peter Coad calls the “Do It Myself” strategy or pattern [Coad95]. That is:

Do It Myself

“I (a software object) do those things that are normally done to the actual object that I'm an abstraction of.” [Coad95]

This is the classic object-oriented design style: Circle objects draw themselves, Square objects draw themselves, Text objects spell-check themselves, and so forth.

Notice that a Text object spell-checking itself is an example of Information Expert: The object that has the information related to the work does it (a Dictionary is also a candidate, by Expert).

Do It Myself and Information ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required