Component-Based & Software Reuse
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
2003 & 2004 SJSU -- CmpE L10-01-S1 Doc. Template
2003 & 2004 SJSU – CmpE --- M.E. Fayad L10-01-S2 Doc. Template
Understand why pattern
Learn how to document patterns
Explore each section of the
template by example.
Understand the tips, rules, and
guidelines for documenting each
2003 & 2004 SJSU – CmpE --- M.E. Fayad L10-01-S3 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
2003 & 2004 SJSU – CmpE --- M.E. Fayad L10-01-S4 Doc. Template
Solution -- Pattern structure
Applicability with illustrated Examples
Several Perspectives 5
2003 & 2004 SJSU – CmpE --- M.E. Fayad L10-01-S5 Doc. Template
Solution -- Pattern structure
2003 & 2004 SJSU – CmpE --- M.E. Fayad L10-01-S6 Doc. Template
Presents the name of the presented pattern.
Gives a focus and precise name for the pattern to be
Choose the patterns’ names carefully. Patterns’
names should be natural, and descriptive, and
Pattern names are very essential for understanding
the purpose of the pattern. 7
2003 & 2004 SJSU – CmpE --- M.E. Fayad L10-01-S7 Doc. Template
Pattern Name: Rules
Pattern names should be bold and italic
whenever they appear in the text.
It is a single word or a short phrase.
2003 & 2004 SJSU – CmpE --- M.E. Fayad L10-01-S8 Doc. Template
Pattern Name: Tips
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
5. Pattern names must imply the characteristics of EBTs or 9
2003 & 2004 SJSU – CmpE --- M.E. Fayad L10-01-S9 Doc. Template
Presents precisely and briefly the problem this
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?
2003 & 2004 SJSU – CmpE --- M.E. Fayad L10-01-S10 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.
2003 & 2004 SJSU – CmpE --- M.E. Fayad L10-01-S11 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
constraints may contradict with one another.
2003 & 2004 SJSU – CmpE --- M.E. Fayad L10-01-S12 Doc. Template
Forces represent the “Why?”
Forces also represent the problem’s
Forces expose the particulars of the problem.
Forces must be listed based on their priorities.
2003 & 2004 SJSU – CmpE --- M.E. Fayad L10-01-S13 Doc. Template
Solution – Four Parts
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
2. b) Participants
3. c) CRC Cards
4. d) Dynamic behavior will be illustrated and discussed in the 14
applicability of the pattern.
2003 & 2004 SJSU – CmpE --- M.E. Fayad L10-01-S14 Doc. Template
Pattern Structure (1)
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.
2003 & 2004 SJSU – CmpE --- M.E. Fayad L10-01-S15 Doc. Template
Pattern Structure (2)
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
2003 & 2004 SJSU – CmpE --- M.E. Fayad L10-01-S16 Doc. Template
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 & 2004 SJSU – CmpE --- M.E. Fayad L10-01-S17 Doc. Template
Pattern Structure: Rules & Heuristics
Use tagged value
EBTs or Pattern-EBT’s multiplicities is usually one or a
fix number of instances.
Avoid many to many relationship. 18
2003 & 2004 SJSU – CmpE --- M.E. Fayad L10-01-S18 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
2003 & 2004 SJSU – CmpE --- M.E. Fayad L10-01-S19 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.
2003 & 2004 SJSU – CmpE --- M.E. Fayad L10-01-S20 Doc. Template
CRC Cards: Rules
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
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
Classes with multiple roles, such as actors, must have a CRC card per
2003 & 2004 SJSU – CmpE --- M.E. Fayad L10-01-S21 Doc. Template
CRC Cards: Heuristics
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
2003 & 2004 SJSU – CmpE --- M.E. Fayad L10-01-S22 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)
2003 & 2004 SJSU – CmpE --- M.E. Fayad L10-01-S23 Doc. Template
Applicability with Illustrated Examples (1)
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.
2003 & 2004 SJSU – CmpE --- M.E. Fayad L10-01-S24 Doc. Template
Applicability with Illustrated Examples (2)
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).
2003 & 2004 SJSU – CmpE --- M.E. Fayad L10-01-S25 Doc. Template
Applicability with Illustrated Examples (3)
In order to ease the reading of the stable
model, each class should be located within
its layer in the following format:
EBTs BOs IOs
2003 & 2004 SJSU – CmpE --- M.E. Fayad L10-01-S26 Doc. Template
Applicability with Illustrated Examples (4)
[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
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
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
2003 & 2004 SJSU – CmpE --- M.E. Fayad L10-01-S27 Doc. Template
Applicability with Illustrated Examples (5)
AnyView 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
Represents a logical interaction between
the different pattern within the application
2003 & 2004 SJSU – CmpE --- M.E. Fayad L10-01-S28 Doc. Template
Applicability with Illustrated Examples (6)
[e] Use Case Description. List 4-5 detailed use cases.
Behavior Diagrams, such as Sequence Diagrams or
A sequence diagram is a map of a giving use case.
A sequence diagram usually forms a snake (only one
2003 & 2004 SJSU – CmpE --- M.E. Fayad L10-01-S29 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
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.
2003 & 2004 SJSU – CmpE --- M.E. Fayad L10-01-S30 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.
2003 & 2004 SJSU – CmpE --- M.E. Fayad L10-01-S31 Doc. Template
Formalization Using Z++ or Object Z
Describes the pattern structure using
the formal language (Z++ or Object Z)
2003 & 2004 SJSU – CmpE --- M.E. Fayad L10-01-S32 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
2003 & 2004 SJSU – CmpE --- M.E. Fayad L10-01-S33 Doc. Template
Several Perspectives (Optional)
This section of the template provide a brief discussion of
the strategic impact of using the described pattern from
the following perspectives:
2003 & 2004 SJSU – CmpE --- M.E. Fayad L10-01-S34 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).
2003 & 2004 SJSU – CmpE --- M.E. Fayad L10-01-S35 Doc. Template