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 ...
随机推荐
- Ansible之playbook
简介 playbook是一个非常简单的配置管理和多主机部署系统.可作为一个适合部署复杂应用程序的基础.playbook可以定制配置,可以按指定的操作步骤有序执行,支持同步和异步方式.playbook是 ...
- ROM, RAM, Flash Memory
ROM Read-only memory (ROM) is a class of storage medium used in computers and other electronic devic ...
- windows server 2012将计算机、回收站、文档等图标添加到桌面
rundll32.exe shell32.dll,Control_RunDLL desk.cpl,,0
- C语言小技巧
/* 求阶乘时设置最大调用层数,防止栈占满 当从函数进入另一个函数时当前函数的内容会入栈,另一个函数调用完时在出栈 */ int factorial(int n, int level) { //pri ...
- javascript中标签与break和continue的配合使用
var num = 0; outermost: for (var i=0; i<10; i++) { for (var j=0; j<10; j++) { if (j==5 || i==5 ...
- Tesseract训练笔记
[参考] http://www.cnblogs.com/samlin/p/Tesseract-OCR.html https://code.google.com/p/tesseract-ocr/wiki ...
- 错误代码2104:无法下载Silverlight应用程序。请查看Web服务器设置
今天调试Silverlight程序,把ClientBin文件夹下的.xap文件删除后遇到这样一个问题:错误代码2104:无法下载Silverlight应用程序.请查看Web服务器设置.在网上查了一下, ...
- C++模板元编程 - 3 逻辑结构,递归,一点列表的零碎,一点SFINAE
本来想把scanr,foldr什么的都写了的,一想太麻烦了,就算了,模板元编程差不多也该结束了,离开学还有10天,之前几天部门还要纳新什么的,写不了几天代码了,所以赶紧把这个结束掉,明天继续抄轮子叔的 ...
- C++ 局部变量的析构
http://blog.chinaunix.net/uid-52437-id-2108747.html 在一个函数内,申明一个局部类变量.则这个变量什么时候析构呢? 并不是在函数退出,释放栈空间时候析 ...
- Jmeter+jenkins接口性能测试平台实践整理(一)
最近两周在研究jmeter+Jenkin的性能测试平台测试dubbo接口,分别尝试使用maven,ant和Shell进行构建,jmeter相关设置略. 一.Jmeter+jenkins+Shell+t ...