Advanced Object-Oriented Analysis & Design

35
2003 SJSU -- CmpE L24-S1 Doc. Template Advanced Object-Oriented Analysis & Design Dr. M.E. Fayad, Professor Computer Engineering Department, Room #283I College of Engineering San José State University One Washington Square San José, CA 95192-0180 http://www.engr.sjsu.edu/~fayad

description

Advanced Object-Oriented Analysis & Design. Dr. M.E. Fayad, Professor Computer Engineering Department, Room #283I College of Engineering San José State University One Washington Square San José, CA 95192-0180 http://www.engr.sjsu.edu/~fayad. Lesson 24: Documentation Template. 2. - PowerPoint PPT Presentation

Transcript of Advanced Object-Oriented Analysis & Design

2003 SJSU -- CmpE L24-S1 Doc. Template

Advanced Object-Oriented Analysis & Design

Dr. M.E. Fayad, Professor

Computer Engineering Department, Room #283I

College of Engineering

San José State University

One Washington Square

San José, CA 95192-0180

http://www.engr.sjsu.edu/~fayad

2003 SJSU – CmpE --- M.E. Fayad L24-S2 Doc. Template

2

Lesson 24:Documentation Template

2003 SJSU – CmpE --- M.E. Fayad L24-S3 Doc. Template

Lesson Objectives

Objectives

3

Understand why pattern documentation patterns Learn how to document patterns Explore each section of the template by example. Understand the tips, rules, and guidelines for documenting each section.

2003 SJSU – CmpE --- M.E. Fayad L24-S4 Doc. Template

Basically, there are two types of templates for documenting stable patterns:

1. Full Template. Each stable pattern should have a full template that gives a detailed documentation for that pattern. The full template consists of 14 fields that will be discussed in details in the next section.

2. Short Template. A short template is a reduced size version of the full template. This template is usually used to document the pattern when this pattern appears within the main pattern that we are interested in documenting it. Short template consists only five fields. 4

Documentation Templates

2003 SJSU – CmpE --- M.E. Fayad L24-S5 Doc. Template

Pattern Name Problem Context Forces Solution -- Pattern structure Participants CRC Cards Behavior Model Consequences Applicability with illustrated Examples Related Patterns Design/Implementation Issues Formalization Known Uses Several Perspectives 5

Full Template

2003 SJSU – CmpE --- M.E. Fayad L24-S6 Doc. Template

Pattern Name Problem Context Solution -- Pattern structure Participants

6

Short Template

2003 SJSU – CmpE --- M.E. Fayad L24-S7 Doc. Template

Presents the name of the presented pattern.

Gives a focus and precise name for the pattern to be described.

Choose the patterns’ names carefully. Patterns’ names should be natural, and descriptive, and unambiguous.

Pattern names are very essential for understanding the purpose of the pattern. 7

Pattern Name

2003 SJSU – CmpE --- M.E. Fayad L24-S8 Doc. Template

Pattern names should be bold and italic whenever they appear in the text.

It is a single word or a short phrase.

8

Pattern Name: Rules

2003 SJSU – CmpE --- M.E. Fayad L24-S9 Doc. Template

1. Name has to be a meaningful and natural name.

2. Name must refer to the atomic concept and the core knowledge of the pattern.

3. It has to be unique and descriptive and only refer to the pattern that describes.

4. Multiple names cause confusion but it cannot be avoided. In this case the Aliases must be stated if applicable.

5. Pattern names must imply the characteristics of EBTs or BOs 9

Pattern Name: Tips

2003 SJSU – CmpE --- M.E. Fayad L24-S10 Doc. Template

Presents precisely and briefly the problem this pattern addresses.

It is preferred that the problem is presented in the form of a question. For instance, for the pattern named “Negotiation” the problem could be described in the question: How does one build a negotiation model that can be used to model the negotiation problem in any application?

10

Problem

2003 SJSU – CmpE --- M.E. Fayad L24-S11 Doc. Template

Gives the boundaries of the problem and preconditions in which the pattern may recur. This must be discussed thoroughly to avoid critic.

Context -- Rules:

Context must be clearly described.

List all the preconditions for which the solution is valuable.

11

Context

2003 SJSU – CmpE --- M.E. Fayad L24-S12 Doc. Template

Illustrates the challenges and the constraints that the pattern needs to resolve.

Discusses the issue of the problem and the trade off between these issues.

It is expected that reading these forces will help the reader in realizing the difficulty of the problem, while at the same time it helps him to appreciate the importance of having a solution to this problem.

It must discuss problem’s constraints. Forces and constraints may contradict with one another. 12

Forces

2003 SJSU – CmpE --- M.E. Fayad L24-S13 Doc. Template

Forces represent the “Why?”

Forces also represent the problem’s constraints.

Forces expose the particulars of the problem.

Forces must be listed based on their priorities.13

Forces: Rules

2003 SJSU – CmpE --- M.E. Fayad L24-S14 Doc. Template

1. a) Static structure, which is stable object model or pattern structure. Static structure reveals the structure of the pattern that contains it participants and the relationships among them. We use UML notation and guidelines for generating the pattern structure. The solution must be described and it may contain pictures, diagrams, textual templates, descriptive artifacts, etc.

2. b) Participants

3. c) CRC Cards

4. d) Dynamic behavior will be illustrated and discussed in the applicability of the pattern. 14

Solution – Four Parts

2003 SJSU – CmpE --- M.E. Fayad L24-S15 Doc. Template

Gives the class diagram of the pattern (EBT or BO).

It also introduces briefly each class and its role.

Associations, aggregations, dependencies, and specializations should be included in the class diagram.

Association classes, constraints, interfaces, tagged values, and notes must be included in the class diagram.

A full description of the class diagram should be included.

15

Pattern Structure (1)

2003 SJSU – CmpE --- M.E. Fayad L24-S16 Doc. Template

This part shows and describes briefly the stable object model of the pattern.

We present two class diagrams for each pattern, one is brief version of the class diagram, where only the name of the classes and patterns and their relationships are shown.

The other class diagram is the detailed one where operations and attributes are added to each class and pattern. 16

Pattern Structure (2)

2003 SJSU – CmpE --- M.E. Fayad L24-S17 Doc. Template

17

Pattern Structure: Tag Names

1. <EBT> Class

2. <BO> Class

3. <IO> Class

4. <Pattern-EBT> Pattern represents stable analysis pattern

5. <Pattern-BO> Pattern represents stable design pattern

2003 SJSU – CmpE --- M.E. Fayad L24-S18 Doc. Template

Rules

Follow UML

Use tagged value

Heuristics

      EBTs or Pattern-EBT’s multiplicities is usually one or a

fix number of instances.

Avoid many to many relationship. 18

Pattern Structure: Rules & Heuristics

2003 SJSU – CmpE --- M.E. Fayad L24-S19 Doc. Template

The participants of any pattern can be classified into two main categories: Classes and Patterns. The participants of the pattern are:

1. Classes. List all the classes in the pattern and a short description for each.

2. Patterns. List all the patterns in the main pattern and a short decription for each

19

Participants (1)

2003 SJSU – CmpE --- M.E. Fayad L24-S20 Doc. Template

(Pattern-EBT = Stable Analysis Pattern, or Pattern-BO = Stable Design Pattern)

EBTs usually do not have multiplicity around them (always considered to be 1, or a fixed number or a range if you are not sure.)

Between any two components in the pattern class diagram the multiplicity, roles, and relationship names should be added. 20

Participants: Rules

2003 SJSU – CmpE --- M.E. Fayad L24-S21 Doc. Template

A Role must be specified per the card’s class.

Each CRC-Card should contain one and only one responsibility. This responsibility has to be unique and it must be specified within context.

The Clients names are listed under each other without using bullets or dashes.

Server part should contain all the services provided by the current Class/Pattern listed without bullets. Each severs will be written as an operation starting with small letter and has two curve parenthesizes at the end.

Classes with multiple roles, such as actors, must have a CRC card per role.

21

CRC Cards: Rules

2003 SJSU – CmpE --- M.E. Fayad L24-S22 Doc. Template

CRC Card filling process: 1. Identify the CRC card’s class name, 2. Name its role, 3. Name its responsibility under responsibility section, 5. List card class’s services (operations) under server and 6. Identify his clients in the client’s section. The clients must have direct or indirect relationships with the card class

22

CRC Cards: Heuristics

2003 SJSU – CmpE --- M.E. Fayad L24-S23 Doc. Template

How does the pattern (EBT or BO) support its objectives?

What are the trade-off and results of using the pattern? Nothing is perfect, and each problem has many issues that are usually hard, if not impossible, to be satisfied at once.

This section lists the affect expected by using this pattern: good results (benefits), bad (drawbacks), ugly (which might cause major problems in specific situations), and the trade-offs (which shows what you gain versus what you scarifies from using this pattern in you development) 23

Consequences

2003 SJSU – CmpE --- M.E. Fayad L24-S24 Doc. Template

Provides clear and detailed case studies for applying the pattern in different contexts. This section shows how the pattern can be used in different applications.

Usually, it is good to show the applicability of the pattern through two examples where each example has different nature.

24

Applicability with Illustrated Examples (1)

2003 SJSU – CmpE --- M.E. Fayad L24-S25 Doc. Template

For each case study the following subsections are usually filled:

[a] Case Study # x: Case study name

[b] Problem Description. This is a short problem statement about the case study where the pattern will be used.

[c] Problem Class Diagram. Shows the class diagram of the problem with highlighting the original pattern in different color (gray, for instance).

25

Applicability with Illustrated Examples (2)

2003 SJSU – CmpE --- M.E. Fayad L24-S26 Doc. Template

In order to ease the reading of the stable model, each class should be located within its layer in the following format:

26

Applicability with Illustrated Examples (3)

EBTs BOs IOs

2003 SJSU – CmpE --- M.E. Fayad L24-S27 Doc. Template

[d] Role-based Instance Diagram and Role-based Scenario for Pattern. Role-based Instance Diagram is a diagram that shows how can each pattern/class in the main pattern class diagram is instantiated in the example.

It also shows how the pattern components interact with each others in the application soul.

Figure, in the next slide, describes the symbols that are used in the Role-based instance diagram.

The Role-based Scenario is a description of the role-based instance diagram in story wise, where each component in the pattern plays its role in the scenario.

We found this story useful in gaining better understanding of the problem. In this scenario the pattern names are written in bold italic. The roles are written in bold and underlined 27

Applicability with Illustrated Examples (4)

2003 SJSU – CmpE --- M.E. Fayad L24-S28 Doc. Template

Applicability with Illustrated Examples (5)

Represents the pattern name as given in the pattern object diagram

Points to an instance of the pattern in the current application example.

Represents the typical flow of the interactions within the application example.

Represents a logical interaction between the different pattern within the application example.

AnyView

2003 SJSU – CmpE --- M.E. Fayad L24-S29 Doc. Template

29

Applicability with Illustrated Examples (6)

[e] Use Case Description. List 4-5 detailed use cases.

Behavior Diagrams, such as Sequence Diagrams or STDs

Sequence Diagrams

A sequence diagram is a map of a giving use case.

A sequence diagram usually forms a snake (only one snake)

2003 SJSU – CmpE --- M.E. Fayad L24-S30 Doc. Template

Specification Model for the Pattern represents the AnyParty’s view of the pattern; therefore, it describes what the AnyParty (i.e., user) may expect. The classes and relationships illustrate the vocabulary of the pattern requirements.

Type Specifications.

Hooks Description. Hooks are extension points on the BOs that can be adapted by AnyParty (e.g. application developers, users, operators). Each hook provides a specific requirement to be fulfilled by AnyParty and documents how to extend the pattern or the framework to meet the requirements. All BOs provide implemented hooks that can be utilized by IOs, application classes. 30

Design/Implementation Issues

2003 SJSU – CmpE --- M.E. Fayad L24-S31 Doc. Template

Shows other patterns that usually interact with the described pattern, and those who are included within the described pattern. Related patterns can be classified as related analysis or design patterns and related design patterns. Related patterns usually share common forces and rationale.

31

Related Patterns

2003 SJSU – CmpE --- M.E. Fayad L24-S32 Doc. Template

Describes the pattern structure using the formal language (Z++ or Object Z)

32

Formalization Using Z++ or Object Z

2003 SJSU – CmpE --- M.E. Fayad L24-S33 Doc. Template

Gives some examples of the uses of this pattern in existing systems (if the pattern has been already deployed before).

Or it gives examples of existing system that can utilize this pattern as an alleviative to what they use currently

33

Known Uses

2003 SJSU – CmpE --- M.E. Fayad L24-S34 Doc. Template

This section of the template provide a brief discussion of the strategic impact of using the described pattern from the following perspectives:

Budgetary

Culture

Technical

Managerial

Marketing

Economic Impact34

Several Perspectives (Optional)

2003 SJSU – CmpE --- M.E. Fayad L24-S35 Doc. Template

Use the pattern documentation template to document all EBTs (Stable Analysis Patterns) and all BOs (Stable Design Patterns) of the stable model (project #1).

35

Discussion Questions