没有合适的资源?快使用搜索试试~ 我知道了~
首页Java modeling in color with UML
资源详情
资源评论
资源推荐
Page 1
©1999 Object International, Inc. All rights reserved. www.oi.com
Pink is my favorite crayon.
Aerosmith
1 Archetypes, Color, and the Domain-Neutral
Component
Color profoundly affects how we see the world around us.
Just as the transition from black-and-white photography to color is so
profound, the transition from black-and-white modeling is an awesome one.
Welcome to the world of modeling with archetypes, color, a domain-neutral
component, and a dozen domain-specific compound components.
In this chapter, you'll learn and apply archetypes, color, and the domain-neutral
component. In Chapters 2-5, you'll read and apply domain-specific components. In
Chapter 6, you'll discover feature-driven development, the process for all of this into
best practice.
This book focuses on modeling with color, archetypes, and components—along
with a process for putting it into practice.
How does Java fit in? The model shapes are Java inspired. You'll find
composition rather than inheritance. You'll also see a judicious use of interface
plug-in points—for added flexibility. In addition, the CD includes all of the models
including Java skeleton source code.
We've developed this book as a front-end companion to Java Design. That book
delivers specific strategies for designing with composition, designing with threads,
and designing with notification.
Examples throughout this book use Unified Modeling Language (UML) notation.
Class-diagram notation and some conventions used in this book are shown in
Figure 1-1. Sequence-diagram notation and some conventions used in this book are
shown in Figure 1-2. We suggest you scan those figures now, then refer back to
them from time to time along the way.
1.1 Archetypes
Now let's turn our attention to this chapter's first major topic: archetypes.
Java Modeling in Color with UML
Chapter 1: Introduction
Page 2
0..*
0..1
actual
plan
smaller
larger
1
0..*
aggregation link
1 0..*
link role
association link
0..1
1
0..*
1 0..*
0..1
0..*
0..*
0..1
0..*
0..1
0..1
0..*
plan
actual
0..1
0..*
larger
smaller
Class3
attribute
method
Class2
attribute
method
Usual
cardinalities
for association
and aggregation
links:
0..1 1
0..* 1..*
Class4
attribute
method
Inheritance
link (points
from specialization
to generalization)
interface
Interface1
method
Implements
link (points from
implementer to
interface)
Class5
attribute
method
classMethod
A Class5 object might
hold an Interface1
implementer.
The 0..* cardinality
indicates that a class1
object holds a collection
of some number of
class2 objects.
The 1 cardinality
indicates that a
class2 object holds
exactly one class1
object.
An interface specifies
method signatures; it's
up to an implementer to
implement that method.
Class1
attribute
method
A class with an italicized
name is an abstract class
(a class without objects).
An underlined method
is a static method
(class method), a
method performed by
the class rather than by
the objects in a class.
<<text label, called a stereotype>>
Class6
attribute
method
Class7
attribute
Class8
attribute
method
Association link
from one object
to others in the
same class (with
example "link role"
labels)
Aggregation link
from one object
to others in the
same class (with
example "link role"
labels)
Component
This is a UML package.
Convention: use it as a
component symbol.
...Component.Class9
attribute
method
...Component.Class10
Convention: A clipped class-
symbol indicates the class is
from another component. It lists
attributes and methods when
some of them might be helpful
in understanding the component
you are looking at.
Figure 1-1. Class-diagram notation and conventions.
Java Modeling in Color with UML
Chapter 1: Introduction
Page 3
aSender
anObject2
...Class2
anObject3
...Class3
The box is an object.
Inside: object name,
then class name.
The arrows are messages,
from sender to receiver
(and back again).
The wide bars
are activation bars,
showing when an
object is active.
The vertical dashed lines
are lifelines, indicating
the life of the object
over time.
A sequence begins
with a sender, some
object that invokes
the initial method.
Convention: Use "FOR each"
notes to indicate iteration (rather
than a UML asterisk, limited to
a single message-send).
Convention: Use IF and ELSE
notes for conditions (rather than
UML brackets; need room for
writing the condition).
Time moves
down the page;
message arrows
may travel left to
right or right to left.
A clipped arrowhead
indicates an asynchronous
message.
A message name in single quotes
is a comment; corresponding
class diagram(s) won't include
a corresponding method for it.
Most common use: getters and setters.
Convention: Use notes to list
arguments for messages that
need them (helps keep message-
arrow labels from becoming too long).
This is a self-delegation
message. The object
invokes one of its own
methods.
1: method
2: method
3: method
4: 'getAttribute'
5: method
1: method
2: method
3: method
4: 'getAttribute'
5: method
Figure 1-2. Sequence-diagram notation and conventions.
Here's the concept we want to communicate:
A form or template for one of a small number of class categories. It specifies
attributes, links, methods, plug-in points, and interactions that are typical for
classes in that category.
Which is the better term for this concept?
Stereotype
1. An unvarying model, as though cast from a mold
2. A text tag for annotating a UML diagram element
3. A broad categorization of classes
Archetype
A model from which all things of the same kind more or less follow.”
[Derived from Webster75 and Haykawa68]
"Archetype" says it best.
Yet which archetypes prove most useful in building better models?
We've developed hundreds of models in dozens of business and engineering
domains. Along the way, we continually looked for ways to "abstract up" to a
domain-neutral component – a small model of archetypes that we could apply again
and again in our workshops and mentoring assignments. Why? We felt we could
teach more in less time and accomplish more in less time. Better for our clients,
more interesting for us, win-win.
Over time, we've discovered four interconnected archetypes that form a domain-
neutral component:
- The moment-interval archetype
- The role archetype
Java Modeling in Color with UML
Chapter 1: Introduction
Page 4
- The "catalog-entry-like description" archetype
- The "party, place or thing" archetype.
We'd like to acknowledge that Peter Coad and Mark Mayfield laid the early
groundwork for these four archetypes, first described in [Coad92] and later
extended with David North in [Coad95-97].
1.1.1 The moment-interval archetype
The first archetype in importance is a moment in or interval of time. It
represents something that one needs to work with and track for business or legal
reasons that occurs at a moment in time, or over an interval of time. For short, we
call it a "moment-interval" to help remind us that we are looking for either a
moment or an interval of importance in the problem domain.
A sale is made at a moment in time, the date and time of that sale.
A rental happens over an interval of time, from checkout to check-in. A
reservation occurs over an interval of time, from the time that it is made until the
time it is used, canceled, or expires.
A sale could even be an interval of time, if you track the duration of the sale for
performance assessments.
What's important is that it is one of these two, not which one of the two it is. So
we establish it as one archetype, moment-interval.
1.1.1.1 Using archetypes to identify classes and much more
In any domain, one can look for moment-intervals and begin building a model.
In material-resource management, we can move from request to RFQ to PO to
delivery to invoice. In manufacturing management, we can move from a planned
process and its steps to an actual process and its steps.
So one of the ways that archetypes help in guiding model building is in
identifying classes that need to be included in the model.
Yet archetypes are more than simply a categorization of classes. They are also a
categorization of the responsibilities (the attributes, links, methods, plug-in points,
and interactions) that such classes usually have.
1.1.1.2 Labeling an archetype
What we need is a text tag, so we can indicate which archetype we are applying
when establishing a class. In UML, that text tag is called a stereotype, an extension
mechanism within that notation (Figure 1-3).
<<moment--interval>>
Sale
number
date
calcTotal
Figure 1-3. Using a UML text tag to indicate a moment-interval.
Java Modeling in Color with UML
Chapter 1: Introduction
Page 5
The problem is that text tags like <<moment-interval>> hide some very
important meaning in a rather plain and simple text label. In a family of diagrams,
that little label is lost in the noise as it begins to look like all the other labels. And
that is too bad; expressing the archetype is far more important than it would be
getting credit for. It would be nice if one could give this added layer of information
added punch, so it could:
- Grab your attention to work on that part of the diagram first
- Help you discover a progression of moment-intervals over time
- Guide you in linking other classes into the moment-interval you are
working with
- Quietly move you to considering what is linked to that moment-interval
and how it works with others to get things done.
Expressing archetypes with color is the extra dimension, the added punch that
does all that and more.
1.1.1.3 Implementing archetypes
What does an archetype look like in source code?
An archetype describes a model that classes within that archetype more or less
follow. It's the "more or less" aspect that is important here.
Could we implement an archetype as a superclass and then inherit from it? No!
Here's why. The very nature of an archetype is that each and every class that
follows an archetype only more or less follows it. Inheritance is far too rigid for what
archetypes are all about, what they need to express.
The other way to implement an archetype is by using a keyword-coded
comment, one that modeling tools can recognize and use effectively. In Java, we do
this with a javadoc-style comment, using a coded keyword. For example, here's
such a comment with an embedded keyword (following the @ symbol)"
/** @archetype moment-interval*/
public class Sale {
public BigDecimal calcTotal(){
}
private int number;
private Date date;
}
That gets the job done nicely.
1.1.2 The role archetype
The second archetype in importance is a role. A role is a way of participation by
a person, place, or thing.
Another way to say this is that a role is a way of participation by a party (person
or organization), place or thing. We like this better, since many times a person or
organization are eligible to play the same role (for example, owner) within a problem
domain that we are working in.
剩余85页未读,继续阅读
loginlog
- 粉丝: 0
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 收起
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
会员权益专享
最新资源
- 数据结构1800题含完整答案详解.doc
- 医疗企业薪酬系统设计与管理方案.pptx
- 界面与表面技术界面理论与表面技术要点PPT学习教案.pptx
- Java集合排序及java集合类详解(Collection、List、Map、Set)讲解.pdf
- 网页浏览器的开发 (2).pdf
- 路由器原理与设计讲稿6-交换网络.pptx
- 火电厂锅炉过热汽温控制系统设计.doc
- 企业识别CIS系统手册[收集].pdf
- 物业管理基础知识.pptx
- 第4章财务预测.pptx
- 《集成电路工艺设计及器件特性分析》——实验教学计算机仿真系.pptx
- 局域网内共享文件提示没有访问权限的问题借鉴.pdf
- 第5章网络营销策略.pptx
- 固井质量测井原理PPT教案.pptx
- 毕业实习总结6篇.doc
- UGNX建模基础篇草图模块PPT学习教案.pptx
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论1