design patterns in opm presented by: galia shlezinger instructors: prop. dov dori, dr. iris berger
Post on 20-Dec-2015
212 views
TRANSCRIPT
![Page 1: Design Patterns In OPM Presented by: Galia Shlezinger Instructors: Prop. Dov Dori, Dr. Iris Berger](https://reader033.vdocuments.us/reader033/viewer/2022051820/56649d415503460f94a1bb84/html5/thumbnails/1.jpg)
Design Patterns In OPM
Presented by: Galia Shlezinger
Instructors: Prop. Dov Dori, Dr. Iris Berger
![Page 2: Design Patterns In OPM Presented by: Galia Shlezinger Instructors: Prop. Dov Dori, Dr. Iris Berger](https://reader033.vdocuments.us/reader033/viewer/2022051820/56649d415503460f94a1bb84/html5/thumbnails/2.jpg)
Research purpose
Model known design patterns in OPM Construct a meta-model for design patterns Demonstrate design in OPM using a test-
case Develop best practices for design in OPM Hopefully, Develop new design patterns for
OPM.
![Page 3: Design Patterns In OPM Presented by: Galia Shlezinger Instructors: Prop. Dov Dori, Dr. Iris Berger](https://reader033.vdocuments.us/reader033/viewer/2022051820/56649d415503460f94a1bb84/html5/thumbnails/3.jpg)
Topics of this presentation
In this presentation we will review three well known Design patterns from “Design patterns: Elements of Reusable Object-Oriented Software”. And how they are modeled in OPM.
We will see that these three design patterns are naturally “built into” OPM and their positive consequences are relevant for most OPM models.
![Page 4: Design Patterns In OPM Presented by: Galia Shlezinger Instructors: Prop. Dov Dori, Dr. Iris Berger](https://reader033.vdocuments.us/reader033/viewer/2022051820/56649d415503460f94a1bb84/html5/thumbnails/4.jpg)
The Command Design Pattern
“Intent: Encapsulate a request as an object, thereby letting you parameterize clients with different requests, queue or log requests, and support undoable operations.”[1]
application
Menu item
interface
paste
document
![Page 5: Design Patterns In OPM Presented by: Galia Shlezinger Instructors: Prop. Dov Dori, Dr. Iris Berger](https://reader033.vdocuments.us/reader033/viewer/2022051820/56649d415503460f94a1bb84/html5/thumbnails/5.jpg)
Command in OPM
Commands are actually processes Processes can be generalized
![Page 6: Design Patterns In OPM Presented by: Galia Shlezinger Instructors: Prop. Dov Dori, Dr. Iris Berger](https://reader033.vdocuments.us/reader033/viewer/2022051820/56649d415503460f94a1bb84/html5/thumbnails/6.jpg)
The Command Design Pattern “Consequences:
1. Decouples the object that invokes the operation from the one that knows how to perform it.
2. Commands are first class objects they can be manipulated and extended like any other object.
3. You can assemble commands into a composite command. (Macro command)
4. Its easy to add new commands, because you don’t have to change existing classes.”
[1].
![Page 7: Design Patterns In OPM Presented by: Galia Shlezinger Instructors: Prop. Dov Dori, Dr. Iris Berger](https://reader033.vdocuments.us/reader033/viewer/2022051820/56649d415503460f94a1bb84/html5/thumbnails/7.jpg)
The Template Method Pattern “Intent: Define the skeleton of an algorithm in an operation, deferring
some steps to subclasses. Template Method lets subclasses redefine certain steps of an algorithm without changing the algorithm’s structure.” [1]
![Page 8: Design Patterns In OPM Presented by: Galia Shlezinger Instructors: Prop. Dov Dori, Dr. Iris Berger](https://reader033.vdocuments.us/reader033/viewer/2022051820/56649d415503460f94a1bb84/html5/thumbnails/8.jpg)
Template method in OPM
Methods are processes
Processes can be aggregated and generalized.
![Page 9: Design Patterns In OPM Presented by: Galia Shlezinger Instructors: Prop. Dov Dori, Dr. Iris Berger](https://reader033.vdocuments.us/reader033/viewer/2022051820/56649d415503460f94a1bb84/html5/thumbnails/9.jpg)
The Template Method Pattern “consequences:
template methods are a fundamental technique for code reuse… they are the means for factoring out common behavior … hook operations…” [1].
![Page 10: Design Patterns In OPM Presented by: Galia Shlezinger Instructors: Prop. Dov Dori, Dr. Iris Berger](https://reader033.vdocuments.us/reader033/viewer/2022051820/56649d415503460f94a1bb84/html5/thumbnails/10.jpg)
The Visitor Design Pattern
“Intent: Represent an operation to be preformed on the element of an object structure. Visitor lets you define a new operation without changing the classes of the elements on which it operates.”[1].
nodeNode visitor
Type checking
visitor
VariableRef Node
![Page 11: Design Patterns In OPM Presented by: Galia Shlezinger Instructors: Prop. Dov Dori, Dr. Iris Berger](https://reader033.vdocuments.us/reader033/viewer/2022051820/56649d415503460f94a1bb84/html5/thumbnails/11.jpg)
Visitor in OPM
Operations are processes Different operations are all specialization of a
common generalized operation that is actually the operation interface.
The element object is an instrument of this generalized process.
![Page 12: Design Patterns In OPM Presented by: Galia Shlezinger Instructors: Prop. Dov Dori, Dr. Iris Berger](https://reader033.vdocuments.us/reader033/viewer/2022051820/56649d415503460f94a1bb84/html5/thumbnails/12.jpg)
The Visitor Design Pattern
“Consequences:
1. Visitor makes adding new operations easy…
2. A visitor gathers related operations and separates unrelated ones…
3. Adding new concrete element classes is hard…
4. Breaking encapsulation…”
[1]
![Page 13: Design Patterns In OPM Presented by: Galia Shlezinger Instructors: Prop. Dov Dori, Dr. Iris Berger](https://reader033.vdocuments.us/reader033/viewer/2022051820/56649d415503460f94a1bb84/html5/thumbnails/13.jpg)
Conclusions
OPM advantages: Decoupling Less sub-classing Breaking encapsulation
OPM disadvantages: Breaking encapsulation
![Page 14: Design Patterns In OPM Presented by: Galia Shlezinger Instructors: Prop. Dov Dori, Dr. Iris Berger](https://reader033.vdocuments.us/reader033/viewer/2022051820/56649d415503460f94a1bb84/html5/thumbnails/14.jpg)
Some more research goals
Studying design pattern structure using OPM models.
Studying the relationship between design patterns using OPM models.
Developing best practices and design patterns for solving design problems in OPM.
![Page 15: Design Patterns In OPM Presented by: Galia Shlezinger Instructors: Prop. Dov Dori, Dr. Iris Berger](https://reader033.vdocuments.us/reader033/viewer/2022051820/56649d415503460f94a1bb84/html5/thumbnails/15.jpg)
References
1. Gamma, Helm, Johnson, Vlissides, “Design Patterns: Elements of Reusable Object-Oriented Software”, Addison-Wesley 1994.
2. Dori, “Object-Process Methodology: a Holistic Systems Paradigm”, Springer 2002.
![Page 16: Design Patterns In OPM Presented by: Galia Shlezinger Instructors: Prop. Dov Dori, Dr. Iris Berger](https://reader033.vdocuments.us/reader033/viewer/2022051820/56649d415503460f94a1bb84/html5/thumbnails/16.jpg)
Questions