四川大学:《Java面向对象编程》课程PPT教学课件(Object-Oriented Programming - Java)Unit 1.2 Designing Classes
Topics Covered Today Unit 1. 2 Designing Classes 1. 2. 1 UML Class diagrams 1.2.2 Relationships between Classes 1.2.3 Common Class structures 1.2.4 UML with eclipse
2 Topics Covered Today • Unit 1.2 Designing Classes – 1.2.1 UML Class Diagrams – 1.2.2 Relationships Between Classes – 1.2.3 Common Class Structures – 1.2.4 UML with Eclipse
UML Introduction Programming is like building a house. An architect creates a design, and a builder uses appropriate tools to carry out the design The builder does not proceed without a blueprint from the architect Software developers also need a blueprint to create complex systems The UML is a toolbox of graphical notations used to produce the blueprint a graphical l depiction of the software design UML, Unified modeling language
3 UML Introduction • Programming is like building a house. An architect creates a design, and a builder uses appropriate tools to carry out the design. The builder does not proceed without a blueprint from the architect. • Software developers also need a blueprint to create complex systems. • The UML is a toolbox of graphical notations used to produce the blueprint -- a graphical depiction of the software design • UML, Unified Modeling Language
Unified Modelling Language (UML) A graph ohio cal language for Visualising Specifying Constructin g Documenting Object-oriented software systems ·OMG( Object management Group国际对象管理 组织) is responsible for UML standard
4 Unified Modelling Language (UML) • A graphical language for – Visualising – Specifying – Constructing – Documenting • Object-oriented software systems • OMG (Object Management Group国际对象管理 组织) is responsible for UML standard
UML UML is not a method it does not outline a procedure for designing software; It is a modeling language that captures the design graphically Whatever process you use you can use uml to record the results of your anal ysis and design decisions
5 UML • UML is not a method. It does not outline a procedure for designing software; it is a modeling language that captures the design graphically. • Whatever process you use, you can use UML to record the results of your analysis and design decisions
UML The main reason to use uml notation is communication To discuss design with someone both need to understand the modeling language, not the process used to come up with the design Human language is imprecise Code is too detailed
6 UML • The main reason to use UML notation is communication. – To discuss design with someone, both need to understand the modeling language, not the process used to come up with the design. – Human language is imprecise – Code is too detailed
UML Diagrams Use case diagram(用例图) Class diagram(类图 Behavior diagrams(行为图) Statechart diagram(状态图) Activity diagram(活动图) Interaction diagrams(交互图 Sequence diagram(顺序图) Collaboration diagram(协作图) Implementation diagrams(实现图) Component diagram(组件图) Deployment diagram(部署图)
7 UML Diagrams • Use case diagram (用例图) • Class diagram (类图) • Behavior diagrams (行为图) – Statechart diagram (状态图) – Activity diagram (活动图) – Interaction diagrams (交互图) • Sequence diagram (顺序图) • Collaboration diagram (协作图) • Implementation diagrams (实现图) – Component diagram (组件图) – Deployment diagram (部署图)
Class notation a class is represented by a rectangle with three compartments The first compartment contains the name of the class the second compartment describes the attributes of the class and the third compartment describes the methods of the class
8 Class Notation • A class is represented by a rectangle with three compartments. – The first compartment contains the name of the class; – the second compartment describes the attributes of the class; – and the third compartment describes the methods of the class
UML Class Diagram NameClass name attribute: Type attribute attribute2: Type I+method1(param 1: lype, param2: Type) method +method2 (paramI: Ty pe, param2 pe pe pI rivate ·+ public protected
9 UML Class Diagram NameClass -attribute1 : Type -attribute2 : Type +method1(param1 : Type, param2 : Type) : Type +method2(param1 : Type, param2 : Type) : Type name attribute method • - private • + public • # protected
Employee class This class contains three private attributes name hourly Wage hour Worked It also contains the following public methods Methods to access the values of the attributes getName, getHourly Wage, and getHours Worked Methods to modify the values of the attributes setName set hourly Wage, and setHours Worked a method to obtain the employee's earnings getEarnings
10 Employee Class • This class contains three private attributes: – name – hourlyWage – hourWorked • It also contains the following public methods: – Methods to access the values of the attributes: • getName, getHourlyWage, and getHoursWorked – Methods to modify the values of the attributes: • setName, setHourlyWage, and setHoursWorked – A method to obtain the employee's earnings: • getEarnings
Representation of employee employee name String hourly Wage: Double -hours Worked double +getName(: String +get Hourly Wage(: Double +getHours Worked: Double +setName(newName: String +sethourly Wage(newHourly Wage: Double) +sethours Worked(new Hours Worked Double) +get Earnings(: Double
11 Representation of Employee Employee -name : String -hourlyWage : Double -hoursWorked : Double +getName() : String +getHourlyWage() : Double +getHoursWorked() : Double +setName(newName : String) +setHourlyWage(newHourlyWage : Double) +setHoursWorked(newHoursWorked : Double) +getEarnings() : Double
按次数下载不扣除下载券;
注册用户24小时内重复下载只扣除一次;
顺序:VIP每日次数-->可用次数-->下载券;
- 软件开发环境与工具的选用(PPT课件讲稿)Select software development tool.ppt
- 电子科技大学:《微机原理与接口技术》课程教学资源(PPT实验讲稿,习友宝).ppt
- 北京师范大学:《多媒体技术与网页制作》课程教学资源(PPT课件)数字音频技术.ppt
- 清华大学出版社:《C语言程序设计》课程教学资源(PPT课件讲稿,共十二章,田丽华、岳俊华、孙颖馨).ppt
- 《算法设计与分析》课程教学资源(PPT讲稿)第十五讲 NP完全性理论与近似算法.pptx
- 西安电子科技大学:《现代密码学》课程教学资源(PPT课件讲稿)第八章 密钥分配与密钥管理.pptx
- 河南中医药大学(河南中医学院):《计算机网络》课程教学资源(PPT课件讲稿)第二章 物理层(阮晓龙).pptx
- 中国人民大学:A Survey on PIM(PPT讲稿).ppt
- 《电脑组装与维护实例教程》教学资源(PPT课件讲稿)第13章 计算机的保养.ppt
- 《计算机网络》课程教学资源(PPT课件讲稿)Chapter 06 广域网技术.ppt
- 《Link Layer Computer Networking:A Top Down Approach》课程教学资源(PPT课件讲稿)Chapter 5 The Data Link Layer.ppt
- 《计算机辅助设计——CAD制图》课程标准.pdf
- 合肥工业大学:《网络安全概论》课程教学资源(PPT课件讲稿)无线网络安全.ppt
- 《单片机原理及应用》课程教学资源(PPT课件讲稿)第3章 MCS-51单片机的指令系统.pptx
- 中国科学技术大学:《微机原理》课程教学资源(PPT课件讲稿)第八章 中断系统.pptx
- 南京航空航天大学:《模式识别》课程教学资源(PPT讲稿)Model Selection for SVM & Our intent works.ppt
- 上海交通大学:《数字图像处理 Digital Image Processing》课程教学资源(PPT课件讲稿,第三版)Chapter 9 Morphological Image Processing.pptx
- Cassandra and Sigmod contest.pptx
- 《计算机应用基础》课程教学资源(PPT讲稿)统考考前辅导.ppt
- 《编译原理》课程教学资源(PPT课件讲稿)上下文无关文法——自顶向下分析.pptx
- 《计算机系统结构》课程教学资源(PPT课件讲稿)第三章 流水线技术.ppt
- 计算机外设及电源故障处理(PPT课件讲稿).ppt
- 中国科学技术大学:《数据结构及其算法》课程电子教案(PPT课件讲稿)第六章 二叉树和树.pps
- 中国科学技术大学:《现代密码学理论与实践》课程教学资源(PPT课件讲稿)第9章 公钥密码学与RSA.pptx
- Landmark-Based Speech Recognition.ppt
- 《微型计算机原理及应用》课程教学资源(PPT课件讲稿)第2章 微处理器.ppt
- 《计算机网络》课程教学资源(PPT课件讲稿)第六章 IP路由.ppt
- Urandaline Investments The Perils of Down Under:Chinese Investment in Australia.pptx
- 四川大学:《数据库技术》课程教学资源(PPT课件讲稿)第1章 数据库技术概论.ppt
- 《数据结构》课程教学资源(PPT课件讲稿)第四章 串.ppt
- 西安电子科技大学:《Mobile Programming》课程PPT教学课件(Android Programming)Lecture 7 数据持久化 Data Persistence.pptx
- 《轻松学习C语言》教学资源(PPT课件讲稿,繁体版,共十二章).pptx
- 《计算机组装维修及实训教程》课程教学资源(PPT课件)第2章 中央处理器.ppt
- 《操作系统》课程教学资源(PPT课件)第六章 设备管理 Devices Management.ppt
- 《编译原理》课程教学资源(PPT课件讲稿)第三章 语法分析.ppt
- Object-Oriented Programming(Java).ppt
- Threads, SMP, and MicroKernels.ppt
- 对等网络 Peer-to-Peer Networks(P2P).ppt
- 香港浸会大学:《网络管理 Network Management》课程教学资源(PPT课件讲稿)Chapter 02 Network Management Model.ppt
- 中国科学技术大学:《高级操作系统 Advanced Operating System》课程教学资源(PPT课件讲稿)第四章 分布式进程和处理机管理(主讲:熊焰).ppt