Trusted Components: Reuse, Contracts and Patterns - Lecture 7
1
Chair of Softw are Engineering
Last update: 2 November 2004
Trusted Components
Reuse, Contracts and Patterns
- Prof. Dr. Bertrand Meyer
- Dr. Karine Arnout
Trusted Components Reuse, Contracts and Patterns Prof. Dr. Bertrand - - PowerPoint PPT Presentation
1 Last update: 2 November 2004 Trusted Components Reuse, Contracts and Patterns Prof. Dr. Bertrand Meyer Dr. Karine Arnout Chair of Softw are Engineering Trusted Components: Reuse, Contracts and Patterns - Lecture 7 2 Lecture 7: Pattern
Trusted Components: Reuse, Contracts and Patterns - Lecture 7
1
Chair of Softw are Engineering
Last update: 2 November 2004
Trusted Components: Reuse, Contracts and Patterns - Lecture 7
2
Chair of Softw are Engineering
Trusted Components: Reuse, Contracts and Patterns - Lecture 7
3
Chair of Softw are Engineering
Trusted Components: Reuse, Contracts and Patterns - Lecture 7
4
Chair of Softw are Engineering
2.1 Skeleton 2.1.2 No method 2.1.1 Method 2.3 Some library support 1. Componentizable 2.2 Possible skeleton 2. Non-componentizable 1.3 Newly componentized 1.1 Built-in 1.2 Library- supported 1.3.2 Componentizable but not comprehensive 1.3.1 Fully componentizable 1.3.3 Componentizable but unfaithful 1.3.4 Componentizable but useless Design pattern 2.4 Design idea 1.4 Possible component Prototype Flyweight Observer Mediator Abstract Factory Factory Method Visitor Command Composite Chain of Responsibility Builder Proxy State Strategy Memento Decorator Adapter Template Method Bridge Singleton Iterator Facade Interpreter
Trusted Components: Reuse, Contracts and Patterns - Lecture 7
5
Chair of Softw are Engineering
Trusted Components: Reuse, Contracts and Patterns - Lecture 7
6
Chair of Softw are Engineering
Trusted Components: Reuse, Contracts and Patterns - Lecture 7
7
Chair of Softw are Engineering
PATTERN_ WIZARD + PW_INITIAL_ WINDOW * PW_INITIAL_ WINDOW_IMP * PW_PATTERN_ VERTICAL_BOX + PW_DECORATOR_ VERTICAL_BOX + PW_DECORATOR_ INFORMATION * PW_PATTERN_ INFORMATION * PW_PATTERN_ CODE_GENERATOR + PW_DECORATOR_ CODE_GENERATOR PW_SKELETON_ NAMES
gui model generation
PW_ SUPPORT
support
Trusted Components: Reuse, Contracts and Patterns - Lecture 7
8
Chair of Softw are Engineering
Trusted Components: Reuse, Contracts and Patterns - Lecture 7
9
Chair of Softw are Engineering
PATTERN_ WIZARD + PW_INITIAL_ WINDOW * PW_INITIAL_ WINDOW_IMP * PW_PATTERN_ VERTICAL_BOX + PW_DECORATOR_V ERTICAL_BOX + PW_DECORATOR_ INFORMATION * PW_PATTERN_ INFORMATION * PW_PATTERN_ CODE_GENERATOR + PW_DECORATOR_ CODE_GENERATOR PW_SKELETON_ NAMES
gui model generation
PW_ SUPPORT
support
Trusted Components: Reuse, Contracts and Patterns - Lecture 7
10
Chair of Softw are Engineering
class PW_DECORATOR_INFORMATION feature component_class_name: STRING feature_name: STRING effective_component_class_name: STRING … end
Trusted Components: Reuse, Contracts and Patterns - Lecture 7
11
Chair of Softw are Engineering
deferred class PW_INITIAL_WINDOW_IMP ... feature { NONE} -- Implementation (Pattern information) decorator_info: PW_DECORATOR_INFORMATION is
require decorator_pattern_vbox_not_void: decorator_pattern_vbox / = Void local frame: PW_DECORATOR_PROPERTY_SELECTOR do create Result frame : = decorator_pattern_vbox.pattern_properties_frame Result.set_component_class_name (frame.component_class_name) Result.set_feature_name (...) ... if frame.is_component_with_additional_attribute_generation then Result.set_component_with_additional_attribute_generation (True) ... end if frame.is_component_with_additional_behavior_generation then ... end ensure decorator_info_not_void: Result / = Void end end
Trusted Components: Reuse, Contracts and Patterns - Lecture 7
12
Chair of Softw are Engineering
PATTERN_ WIZARD + PW_INITIAL_ WINDOW * PW_INITIAL_ WINDOW_IMP * PW_PATTERN_ VERTICAL_BOX + PW_DECORATOR_V ERTICAL_BOX + PW_DECORATOR_ INFORMATION * PW_PATTERN_ INFORMATION * PW_PATTERN_ CODE_GENERATOR + PW_DECORATOR_ CODE_GENERATOR PW_SKELETON_ NAMES
gui model generation
PW_ SUPPORT
support
Trusted Components: Reuse, Contracts and Patterns - Lecture 7
13
Chair of Softw are Engineering
deferred class PW_PATTERN_CODE_GENERATOR feature -- Access pattern_info: PW_PATTERN_INFORMATION
project_directory: STRING
feature -- Status report root_class_and_ace_file_generation: BOOLEAN
feature -- Element change set_pattern_info (a_pattern_info: like pattern_info) is … set_project_directory (a_project_directory: like project_directory) is … set_root_class_and_ace_file_generation (a_value: like root_class_and_ace_file_generation) is … feature -- Generation generate
require pattern_info_not_void: pattern_info / = Void pattern_info_complete: pattern_info.is_complete invariant project_directory_not_empty_and_exists_if_not_void: project_directory / = Void im plies (not project_directory.is_empty and directory_exists (project_directory)) end
Trusted Components: Reuse, Contracts and Patterns - Lecture 7
14
Chair of Softw are Engineering
Trusted Components: Reuse, Contracts and Patterns - Lecture 7
15
Chair of Softw are Engineering
Trusted Components: Reuse, Contracts and Patterns - Lecture 7
16
Chair of Softw are Engineering
deferred class interface PW_PATTERN_CODE_GENERATOR ... feature { NONE} -- Implementation (Code generation) generate_code (a_new_file_name, a_skeleton_file_name: STRING; some_changes: LINKED_LIST [ TUPLE [ STRING, STRING] ]
require a_new_file_name_not_void: a_new_file_name / = Void a_new_file_name_not_empty: not a_new_file_name.is_empty a_skeleton_file_name_not_void: a_skeleton_file_name / = Void a_skeleton_file_name_not_empty: not a_skeleton_file_name.is_empty a_skeleton_file_exists: file_exists (a_skeleton_file_name) some_changes_not_void: some_changes / = Void no_void_change: not some_changes.has (Void)
… end
Trusted Components: Reuse, Contracts and Patterns - Lecture 7
17
Chair of Softw are Engineering
Trusted Components: Reuse, Contracts and Patterns - Lecture 7
18
Chair of Softw are Engineering
Trusted Components: Reuse, Contracts and Patterns - Lecture 7
19
Chair of Softw are Engineering
Trusted Components: Reuse, Contracts and Patterns - Lecture 7
20
Chair of Softw are Engineering
Trusted Components: Reuse, Contracts and Patterns - Lecture 7
21
Chair of Softw are Engineering
Trusted Components: Reuse, Contracts and Patterns - Lecture 7
22
Chair of Softw are Engineering
Trusted Components: Reuse, Contracts and Patterns - Lecture 7
23
Chair of Softw are Engineering
Trusted Components: Reuse, Contracts and Patterns - Lecture 7
24
Chair of Softw are Engineering
Trusted Components: Reuse, Contracts and Patterns - Lecture 7
25
Chair of Softw are Engineering