Ebook Delphi - Modelmaker Design Patterns - Mmdesignpatterns.pdf

(431 KB) Pobierz
Microsoft Word - DesignPatterns5.doc
Design Patterns Reference
ModelMaker 5
Including a Design Patterns Example
ModelMaker
c/o Gerrit Beuze and Rene Post
Stenenkruis 27 B
6862 XG Oosterbeek
Netherlands
http:\\www.modelmaker.demon.nl
info@ modelmaker.demon.nl
287643641.001.png
ModelMaker 5
Copyright © 1997-1999 by:
ModelMaker
c/o Gerrit Beuze and Rene Post
Stenenkruis 27 B
6862 XG Oosterbeek
Netherlands
http:\\www.modelmaker.demon.nl
info@ modelmaker.demon.nl
All rights reserved.
All brand and product names are trademarks or registered trademarks of their respective
holders.
The latest version of this manual will be availabe on the ModelMaker website.
: G. Beuze
DesignPatterns5,
2
ModelMaker 5
Contents
Introduction
5
Design Patterns
6
Introduction
6
What is a design pattern
6
Patterns in ModelMaker
7
Applying patterns
7
Supported patterns
8
Wrapper pattern
9
Origin
9
Intent
9
Motivation
9
Implementation
10
How to apply the pattern
11
How the pattern acts on changes
12
Mediator pattern
13
Origin
13
Intent
13
Motivation
13
Implementation
14
How to apply the pattern
16
How the pattern acts on changes
17
Singleton pattern
18
Origin
18
Intent
18
Motivation
18
Implementation
18
How to apply the pattern
21
How the pattern acts on changes
21
Decorator pattern
21
Origin
21
Intent
22
Motivation
22
Implementation
23
How to apply the pattern
26
How the pattern acts on changes
28
Lock pattern
28
Origin
28
Intent
28
Motivation
28
Implementation
29
How to apply the pattern
30
How the pattern acts on changes
30
Visitor pattern
31
Origin
31
DesignPatterns5,
3
ModelMaker 5
Intent
31
Motivation
31
Implementation
33
How to apply the pattern
35
How the pattern acts on changes
36
Observer pattern
37
Origin
37
Intent
37
Motivation
37
Implementation
37
Transforming events using the Observer Wizard
40
How to apply the pattern
40
How the pattern acts on changes
40
Reference Count pattern
40
Origin
40
Intent
41
Implementation
41
Patterns example
42
Introduction
42
The TProgressor class
42
Creating the TProgressor class interface
44
Implementing the TProgressor class
45
Applying a Singleton pattern
47
Making TProgressor a singleton class
47
Testing the Singleton behaviour
48
The Singleton pattern reflecting changes
49
Applying an Observer pattern
49
The need for an Observer pattern
49
Transforming events using the Observer Wizard
49
Checking the result
50
The finishing touch
51
Applying a Wrapper pattern
52
The need for a Wrapper pattern
52
Wrapping TProgressor
52
Checking the result
52
The Wrapper pattern reflecting changes
53
Deleting and invalidating patterns
53
Bibliography
55
DesignPatterns5,
4
Introduction
ModelMaker represents a brand new way to develop classes and component packages for
Borland Delphi. ModelMaker is a class tree oriented CASE tool specifically designed for
generating native Delphi code (in fact it was made using Delphi and ModelMaker). Delphi's
Object Pascal language is fully supported by ModelMaker. From the start ModelMaker was
designed to be a smart and highly productive tool. It has been used to create classes for both
real-time / technical and database type applications.
In ModelMaker you'll find a synergy of ideas from the cutting edge of object-oriented and
component-based technology. It was inspired by the work of methodologists like Ivar
Jacobson (OOSE), Ralph Johnson (design patterns) and Karl Lieberherr (adaptive software).
A unique feature, currently not found in any development environment for Delphi, is the
support for design patterns. A number of patterns from the book ‘Design Patterns, Elements of
Reusable Object Oriented Software’ by [Gam+] are implemented as ‘ready to use’ active
agents. A ModelMaker Pattern will not only insert Delphi style code fragments to implement a
specific pattern, but it also stays ‘alive’ to update this code to reflect any changes made to the
design.
As a result, ModelMaker lets you:
• Produce designs and code of unequalled quality.
• Think of designing code instead of typing code.
• Design without compromising.
• Refine and experiment with your designs until they feel just right.
• Create and maintain magnitudes larger models in magnitudes less time.
• Document you designs in UML style diagrams.
• Document your units in help files by clicking a single button.
• In short: save time and money, making better software.
This manual contains the Design Patterns reference and a design patterns demo. Before you go
through this manual and demo you should be fairly accustomed with ModelMaker. Refer to
the Users manual for “Getting Started”and “Basic concepts”.
Zgłoś jeśli naruszono regulamin