Class diagrams
So far we have seen stack diagrams, which show the state of a program, and object diagrams, which show the attributes of an object and their values. These diagrams represent a snapshot in the execution of a program, so they change as the program runs. They are also highly detailed, and for some applications, too detailed. A class diagrams is a more abstract representation of the structure of a program. Instead of showing individual objects, it shows classes and the relationships between them.
There are several kinds of relationship between classes:
- Objects in one class might contain references to objects in another class. For example, each Rectangle contains a reference to a Point, and each Deck contains references to many Cards. This kind of relationship is called HAS-A, as in, ‘a Rectangle has a Point.’
- One class might inherit from another. This relationship is called IS-A, as in, ‘a Hand is a kind of a Deck.’
- Once class might depend on another in the sense that changes in one class would require changes in the other.
A class diagram is graphical representation of these relationships between classes. For example, this diagram shows the relationship between Card, Deck and Hand.
The arrow with a hollow triangle head represents an IS-A relationship; in this case it indicates that Hand inherits from Deck. The standard arrow head represents a HAS-A relationship; in this case a Deck has references to Card objects. The star(*) near the arrow head is a multiplicity; it indicates how many Cards a Deck has. A multiplicity can be a simple number, like 52, a range, like 5..7 or a star, which indicates that a Deck can have any number of Cards.
from Thinking in Python
Class diagrams的更多相关文章
- EF:split your EDMX file into multiple diagrams
我们可以把一个EDMX文件划分为多个类图: 1.在VS中打开EDMX设计器: 2.切换到“模型浏览器”属性设置窗口: 3.在diagrams上右键菜单中选择“添加新的关系图”: 4.在原来的关系图上可 ...
- How to generate UML Diagrams from Java code in Eclipse
UML diagrams compliment inline documentation ( javadoc ) and allow to better explore / understand a ...
- codeforces Diagrams & Tableaux1 (状压DP)
http://codeforces.com/gym/100405 D题 题在pdf里 codeforces.com/gym/100405/attachments/download/2331/20132 ...
- (转) Deep learning architecture diagrams
FastML Machine learning made easy RSS Home Contents Popular Links Backgrounds About Deep learning ar ...
- [RxJS] Marble diagrams in ASCII form
There are many operators available, and in order to understand them we need to have a simple way of ...
- 条形图(diagrams)
条形图(diagrams) 题目描述 小 虎刚上了幼儿园,老师让他做一个家庭作业:首先画3行格子,第一行有3个格子,第二行有2个格子,第三行有3个格子.每行的格子从左到右可以放棋子,但要 求除第一行外 ...
- Generating Sankey Diagrams from rCharts
A couple of weeks or so ago, I picked up an inlink from an OCLC blog post about Visualizing Network ...
- Reliability diagrams
Reliability diagrams (Hartmann et al. 2002) are simply graphs of the Observed frequency of an event ...
- Characterization of Dynkin diagrams
Nowadays, I am reading D.J.Benson's nice book, volume I of Representations and cohomology. I found i ...
随机推荐
- 怎样减少FLASH影片文件过大——绝对好用
网站建设中怎样减少FLASH影片文件过大 一,制作前的处理 1声音(mp3): GoldWave中打开需要处理的mp3,然后把它另存为---在最下一栏的属性中选择较低的字节数,例如,本来的mp3 ...
- onNewIntent调用时机
在IntentActivity中重写下列方法:onCreate onStart onRestart onResume onPause onStop onDestroy onNewIntent 一 ...
- 我的wordpress插件总结
酷壳(CoolShell.cn)WordPress的插件 注意: 下面的这些插件的链接是其插件主页的链接,你可以在WordPress后台管理中添加插件时直接搜索安装就可以了. 插件不是越多越好.WP的 ...
- (C# File) 文件操作
Get Files from Directory [C#] This example shows how to get list of file names from a directory (inc ...
- The tag 'ChartPlotter' does not exist in XML namespace
本地build的时候每次都是OK的,但是Shelveset到Server上build的时候,总是出错. 果断google/bing了几个建议,无果. 不得不重新仔细的看server上的building ...
- 禁止使用finalize方法
Don´t use Finalizers, mainly because are unpredictable and we don´t know when will be executed, &quo ...
- Linux删除乱码文件名或者目录名
有时,rz上传文件失败或者不小心输入命令会产生乱码文件名.因为用rm 删除特殊字符基本无效,故找到了下面两种简单易用的方法: 例子: [langxiaowei@mirror:~]$ ls ?? ...
- MySql中的变量定义
根据mysql手册,mysql的变量分为两种:系统变量和用户变量.但是在实际使用中,还会遇到诸如局部变量.会话变量等概念.根据个人感觉,mysql变量大体可以分为四种类型: 一.局部变量. 局部变量一 ...
- 【收藏用】--切勿转载Java处理XML的三种主流技术及介绍
原帖地址 : http://www.ibm.com/developerworks/cn/xml/dm-1208gub/ XML (eXtensible Markup Language) 意为可扩展标记 ...
- 编写webpy程序,iep 报错,ulipad 运行正确
在web.py编程中,使用模板文件时,iep下会报错.ulipad不会报错. 用python 运行不报错. 在寻找答案.初步估计是iep的python运行环境有问题. 如图: