RAD Studio (Common)
|
Patterns provide software developers with powerful reuse facilities. Rather than trying to tackle each design problem from the very outset, you can use the predefined patterns. The hierarchy of patterns is defined in the Pattern Registry. You can manage and logically arrange your patterns using the Pattern Organizer.
Patterns are intended to:
The Pattern Registry defines the virtual hierarchy of patterns. You can create virtual folders and group the patterns logically to meet your specific requirements. All operations with the contents of the Pattern Registry are performed in the Pattern Organizer and synchronized with the Pattern Registry.
The Pattern Organizer enables you to logically organize patterns (using virtual trees, folders and shortcuts), and view and edit the pattern properties. You will be working with shortcuts, not with the actual patterns. Because of this, shortcuts to the same pattern may be included in several folders.
The UML modeling feature supports templates as a way to provide backward compatibility with the legacy projects from previous versions. You can copy the folders with your legacy source code templates to the Patterns subfolder of your installation directory, and use these templates to create elements in implementation projects.
Templates are text files with the language-specific extensions that use macros to be substituted with real values when the templates are applied. Therefore, templates can be regarded as forms ready for "filling in" for a specific instance. A template consists of a template file containing source code, and a properties file that contains macro descriptions and their default values.
Templates are stored in the Patterns\templates directory of your installation using the following structure:
/<language>/<category>/<template name>
where <category> is CLASS, LINK or MEMBER. Each <template_name> folder contains the following files:
A design pattern is an XML file that contains a sequence of statements or actions, required to create entities and links and set their properties. Each statement creates either one model element or one link between the model elements.
In addition to creating new elements, you can use design patterns to add members to a container element. The pattern that you are applying to the specified container element should have its Use Existent property set as True. You can then apply the pattern to the container element you want to modify. For example, if you want to add several methods stored in a class as pattern to an existing class, then you have to apply that pattern to the diagram where that class exists.
The design patterns are stored as XML files in the Patterns directory of your installation.
A First Class Citizen (FCC) pattern is a specific type of design pattern that contains information about the pattern name and the role of each participant. When applied to a diagram, FCC patterns create their own entities and display on the diagram with links to the created entities. Such patterns enable further modification by means of adding new participants.
Patterns as First Class Citizens are represented by GoF patterns.
A pattern is displayed on a diagram as an oval with the pattern name and an expandable list of participants. Each participant is connected with the pattern oval by a link, labeled with the participant's role.
FCC patterns generate source code, but the oval FCC pattern elements do not. The entities created by patterns are stored in the diagram files.
When you create an inheritance link between a class and another abstract class or interface, the methods and members are not automatically added to the child class. This problem is solved using the Stub implementation pattern. You can also create an implementation link and stub implementation in one step by using the Implementation link and stub pattern.
If the destination of a link is an interface, the pattern makes the class-source implement that interface, and creates in a class the stubs for all of the methods found in the interface and all of its parent interfaces.
If the destination link is an abstract class, this pattern makes the class-source extend the class-destination, and makes stubs for all of the constructors found in the class-destination. These constructor stubs call the corresponding constructors in the class-destination.
You can find the Implementation link and stub pattern in the Pattern Wizard by clicking the Link by Pattern or Node by Pattern buttons in the Tool Palette, or by using the Create by Pattern context menu for a class.
The Implementation link and stub pattern creates the following members of interfaces and abstract classes:
Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
|
What do you think about this topic? Send feedback!
|