Designing object-oriented software is hard, and designing reusable object oriented software is even harder.
A reusable design should be specific to the problem at hand but also general enough to address future problems and requirements.
When a good enough design is found it is reused again and again. At each use the solution becomes more flexible.
This gives the ability to use it next time. By time these design solutions are used to solve specific design problems and make the object oriented design more flexible, elegant, and ultimately reusable
2. Design Patterns
• Designing object-oriented software is hard, and designing reusable
object oriented software is even harder.
• A reusable design should be specific to the problem at hand but also
general enough to address future problems and requirements.
• When a good enough design is found it is reused again and again. At
each use the solution becomes more flexible.
• This gives the ability to use it next time. By time these design
solutions are used to solve specific design problems and make the
object oriented design more flexible, elegant, and ultimately reusable.
3. • These designs help designers reuse successful designs by basing new
designs on prior experience.
• A designer who is familiar with such patterns can apply them
immediately to design problems without having to rediscover them.
4. • Patterns are observed through experience.
• • Patterns are typically written in a structured format.
• • Patterns prevent reinventing the wheel.
• • Patterns exist at different levels of abstraction.
• • Patterns undergo continuous improvement.
• • Patterns are reusable artifacts.
• • Patterns communicate designs and best practices.
• • Patterns can be used together to solve larger problem.
5. Essential elements of patterns
• The Pattern Name is a handle we can use to describe a design problem, its
solutions, and consequences in a word or two. It lets us design at a higher
level of abstraction”
• . • “The Problem “describes when to apply the pattern. It explains the
problem and its context. It might describe specific design problems such as
how to represent algorithms as objects” .
• • “The Solution “describes the elements that make up the design, their
relationships, responsibilities, and collaborations. Note that the solution
does not describe a particular concrete design or implementation” .
• • “The Consequences “are the results and trade-offs of applying the
pattern. Though consequences are often unvoiced when we describe
design decisions, they are critical for evaluating design alternatives and for
understanding the costs and benefits of applying the pattern”.
6. Command design
• Encapsulate a request as an object, thereby letting you parameterize
clients with different requests, queue or log of queues, and support
undo able operations.
• Also known as action or transaction.
• Encapsulating commands into objects.
7. Applicability
• Parameterize objects to perform actions.
• Specify queue and execute request at different times.
• Support undo
• Support logging changes
• Structure a system around high level operations.