UML user guide, chapter 4 Classes - UML用户手册第四章 类
来源:互联网 发布:大香蕉网络在线视频 编辑:程序博客网 时间:2024/06/09 14:31
Classes are the most important building block of any object-oriented system. A class is a description of a set of objects that share the same attributes, operations, relationships, and semantics. A class implements one or more interfaces.
You use classes to capture the vocabulary of the system you are developing. These classes may include abstractions that are part of the problem domain, as well as classes that make up an implementation.
类是面向对象系统里面的最重要的基石, 类是对拥有相同的属性,操作,关系,语义的一组对象的描述.
Every class must have a name that distinguishes it from other classes. A name is a textual string. That name alone is known as a simple name; a qualified name is the class name prefixed by the name of the package in which that class lives. For example java::awt.Retangle, however it's pity that I can not draw it with the tool of Star UML.
Attributes
An attribute is a named property of a class that describes a range of values that instances of the property may hold. A class may have any number of attributes or no attributes at all. An attribute represents some property of the thing you are modeling that is shared by all objects of that class.
Operations
An operation is the implementation of a service that can be requested from any object of the class to affect behavior. In other words, an operation is an abstraction of something you can do to an object that is shared by all objects of that class. A class may have any number of operations or no operations at all.
Organizing Attributes and Operations
When drawing a class, you don't have to show every attribute and every operation at once. In fact, in most cases, you can't (there are too many of them to put in one figure) and you probably shouldn't (only a subset of these attributes and operations are likely to be relevant to a specific view). For these reasons, you can elide a class, meaning that you can choose to show only some or none of a class's attributes and operations. You can indicate that there are more attributes or properties than shown by ending each list with an ellipsis ("..."). You can also suppress the compartment entirely, in which case you can't tell if there are any attributes or operations or how many there are.
To better organize long lists of attributes and operations, you can also prefix each group with a descriptive category by using stereotypes, as shown in Figure 4-7.
WOW, 或者我们应该画出一些重要的方法或属性.
Responsibilities
A responsibility is a contract or an obligation of a class. When you create a class, you are making a statement that all objects of that class have the same kind of state and the same kind of behavior. At a more abstract level, these corresponding attributes and operations are just the features by which the class's responsibilities are carried out
Oops, Star UML似乎不能画职责描述。。
Hints and Tips
When you model classes in the UML, remember that every class should map to some tangible or conceptual abstraction in the domain of the end user or the implementer. A well-structured class
每个类图 对于终端用户或实现者域来说, 应该是对一些切实或有概念的良好抽象。
Provides a crisp abstraction of something drawn from the vocabulary of the problem domain or the solution domain.从问题域的语义或解决方案中 提供一个干脆的事务的抽象
Embodies a small, well-defined set of responsibilities and carries them all out very well.嵌入简单的良好定义的一系列职责, 并用图的形式较好的表达出来
Provides a clear separation of the abstraction's specification and its implementation.提供娘好的抽象和实现。。 。人人都那样想:p
Is understandable and simple, yet extensible and adaptable. 简单且容易理解, 可扩展, 可适配的。。。
When you draw a class in the UML,
Show only those properties of the class that are important to understanding the abstraction in its context. 只画出那些 在环境上下文当中, 对于理解抽象显得重要的属性。
Organize long lists of attributes and operations by grouping them according to their category. 出现大量属性和操作时对于他们进行归类
Show related classes in the same class diagrams. 画图关联的类图
。。。 bto be continued....
- UML user guide, chapter 4 Classes - UML用户手册第四章 类
- UML user guide, chapter 2, UML introduction
- UML user guide, chapter 3 Hello world
- UML user guide, chapter 5 relationships 关系
- Velocity User Guide 用户手册
- Velocity User Guide 用户手册
- Association Classes of UML
- UML图学习第四章
- 第四章:UML序列图
- UML用户手册(第二版)第一章
- UML(user-mode-linux)
- 《UML精粹》 第四章 时序图
- UML第四集
- QT 010 Qt 4.2 在线手册含UML图解释 User's Guide Documentation
- Gradle-user guide-Installing-第四章 安装Gradle(译)
- UML面向对象设计基础 chapter 4 类图
- 《Velocity用户手册》-第四章
- UML
- ASP.NET动态生成HTML页面
- 关于c#中的消息处理函数和vc中的消息处理函数区别
- CHM格式打不开方法
- 将Java代码打包为exe文件
- 读《入侵的艺术》
- UML user guide, chapter 4 Classes - UML用户手册第四章 类
- DAC数模转换总结
- 在COM组件中调用JavaScript函数[转]
- html中嵌入电子时钟和指针时钟的js代码
- EOS案例实现HelloWorld
- C3P0连接池详细配置
- Asp.net验证码仿google波形扭曲彩色核心函数
- 商业模式的概念
- 让postgresql支持存储过程(函数)的调试