Course "UML and Design Patterns" of module "Software Engineering and Design", version February 2011 (X)
|
|
- Ashlie Richardson
- 5 years ago
- Views:
Transcription
1 UML Class Diagrams Prof. Dr. Eric Biel Course "UML and Design Patterns" of module "Software Engineering and Design", version February 2011 (X) BFH/TI/Software Engineering and Design/UML and Design Patterns/UML Class Diagrams/February 2011 (X)/Prof. Dr. E. Dubuis Page 1 of 32
2 Learning Goals You'll learn: Modeling UML classes UML class properties, attributes, and operations Multiplicities of associations Programming interpretations of UML classes Bidirectional associations Generalization BFH/TI/Software Engineering and Design/UML and Design Patterns/UML Class Diagrams/February 2011 (X)/Prof. Dr. E. Dubuis Page 2 of 32
3 Readings [Fowler]: UML Distilled, Martin Fowler, third ed., Addison-Wesley, ISBN [Jeckle]: UML 2 glasklar, Mario Jeckle et al., 2. Auflage, Hanser Verlag, ISBN See also: [UML-Home]: [UML-Specification]: Not all readings are cited in the text that follows. BFH/TI/Software Engineering and Design/UML and Design Patterns/UML Class Diagrams/February 2011 (X)/Prof. Dr. E. Dubuis Page 3 of 32
4 Why Modeling? Models abstract from concrete (implementation) details. Models allow, for example: to express structures A B A 1 0..* B to express structural relationships C A 1 0..* B to express temporal behavior A B C loop to express state-based behavior Wait event DoIt otherevent BFH/TI/Software Engineering and Design/UML and Design Patterns/UML Class Diagrams/February 2011 (X)/Prof. Dr. E. Dubuis Page 4 of 32
5 Why Modeling (cont'd) Models allows (in general more easily than code): to communicate (first, early) ideas on parts of the software to document aspects of the software And: code can be generated from models (MDA: model driven architecture; executable UML) BFH/TI/Software Engineering and Design/UML and Design Patterns/UML Class Diagrams/February 2011 (X)/Prof. Dr. E. Dubuis Page 5 of 32
6 Modeling Levels Models can express different degree of details. Thus, you can: create models for the conceptual-analytical level: abstractness: high, details not expressed A B preciseness: low details: none executable: no create models for the design level: abstractness: lower preciseness: higher details: (some) details are expressed executable: perhaps implementation language independent D 0..* C A 0..* C abstract model is transformed into a more refined one B C' BFH/TI/Software Engineering and Design/UML and Design Patterns/UML Class Diagrams/February 2011 (X)/Prof. Dr. E. Dubuis Page 6 of 32
7 What is the UML? The UML... provides a set of (graphical) notations for the modeling and documentation and... of (software) systems has notational elements for expressing the static (structural) and the dynamic (temporal) aspects of a system BFH/TI/Software Engineering and Design/UML and Design Patterns/UML Class Diagrams/February 2011 (X)/Prof. Dr. E. Dubuis Page 7 of 32
8 Some UML Diagrams class diagram object diagram package diagram use case diagram sequence diagram activity diagram BFH/TI/Software Engineering and Design/UML and Design Patterns/UML Class Diagrams/February 2011 (X)/Prof. Dr. E. Dubuis Page 8 of 32
9 Sample Class Diagram (borrowed from [Fowler]) attributes operations Order datereceived: Date [0..1] ispaid: Boolean [1] number: String [1] X price: Money dispatch close lineitems OrderLine datereceived: Date [0..1] ispaid: Boolean [1] not X * navigable 1 1 X Product * {ordered} multiplicity * 1 association {if Order.customer.getCreditRating is poor then Order.isPrepaid must be true} role name comment contactname X creditrating creditlimit name [1] address [0..1] dispatch close Corporate Customer billformonth(integer) remind() * salesrep Employee Customer Personal Customer creditcardnumber BFH/TI/Software Engineering and Design/UML and Design Patterns/UML Class Diagrams/February 2011 (X)/Prof. Dr. E. Dubuis Page 9 of 32 X 0..1 generalization {getcreditcardrating() == poor } constraint String Date class classes used as types of attributes Money Boolean
10 UML Class compartment (each of it is optional) Order class name datereceived: Date [0..1] ispaid: Boolean [1] number: String [1] price: Money dispatch close a class attributes operations Attributes Format: visibility? /? name :type? multiplicity? =default? {property}* 1 Examples + customer : int - address : String [1.. *] # code : String = Test {readonly} 1 X? denotes zero or one occurrence, {X}* denotes zero or more occurrences of the referenced X. BFH/TI/Software Engineering and Design/UML and Design Patterns/UML Class Diagrams/February 2011 (X)/Prof. Dr. E. Dubuis Page 10 of 32
11 Attributes (cont'd) Visibility: private: -, protected: #, package: ~, public: + Meaning: UML gives not a precise definition. Convention here: as in Java Convention: If no visibility markers are given then read private visibility for attributes. / : derived attribute: value can be calculated from other properties (= attributes, etc.) Name: Type: Typically corresponds to the name of a field in Java. Restriction on the range of values of an attribute. Multiplicity: see below Default value: The value for a newly created object if the attribute isn't specified during creation. BFH/TI/Software Engineering and Design/UML and Design Patterns/UML Class Diagrams/February 2011 (X)/Prof. Dr. E. Dubuis Page 11 of 32
12 Attributes (cont'd) {property-string} indicates additional properties of the attribute. Explained in chapter Advanced Concepts of UML Class Diagrams. BFH/TI/Software Engineering and Design/UML and Design Patterns/UML Class Diagrams/February 2011 (X)/Prof. Dr. E. Dubuis Page 12 of 32
13 Associations properties as attributes properties as associations Date association 0..1 * Order +datereceived: Date [0..1] +ispaid: Boolean [1] +lineitems: OrderLine [*] {ordered} multi-valued property / attribute Order association Date Boolean OrderLine Boolean multiplicity A B Can navigate from :A to :B A B Cannot navigate from :A to :B 1 * lineitems {ordered} OrderLine association navigability BFH/TI/Software Engineering and Design/UML and Design Patterns/UML Class Diagrams/February 2011 (X)/Prof. Dr. E. Dubuis Page 13 of 32
14 Associations (cont'd) The name of a property goes at the target end of the association, together with its multiplicity. There is a small difference, however, for expressing multiplicities: multiplicities can be expressed at both ends of an association line When using attributes or associations? Use attributes for small things : booleans, strings, dates Use associations to relate classes with business meaning : orders, order items, products, customers employee, employee,... Notice: Attributes and associations, respectively, are properties of a class. BFH/TI/Software Engineering and Design/UML and Design Patterns/UML Class Diagrams/February 2011 (X)/Prof. Dr. E. Dubuis Page 14 of 32
15 Multiplicity Multiplicity of a property (I.e., attribute or association): An indication of how many values may fill the property. Format on an attribute: [indication] see next slide Examples: A car has four wheels: wheels : Wheel [4] A student registers with many modules: modules : Module [0..*] A student has one address: address : Address [1] BFH/TI/Software Engineering and Design/UML and Design Patterns/UML Class Diagrams/February 2011 (X)/Prof. Dr. E. Dubuis Page 15 of 32
16 Multiplicity (cont'd) The most common multiplicity indications: 0..1: The property may or may not have a value. 1..1: The property has exactly (and always) a value. Usually denoted as 1 only. Default ([Fowler]). shorthand: * 0..*: The property has zero or more values. 1..*: The property has one or more values. n..m: The property has at least n and at most m values. BFH/TI/Software Engineering and Design/UML and Design Patterns/UML Class Diagrams/February 2011 (X)/Prof. Dr. E. Dubuis Page 16 of 32
17 Programming Interpretation of Properties There is no one way to interpret properties in code. Most common way:! a UML public property is mapped onto: a private field plus getter and setter methods (as in Java) a property (as in C#) BFH/TI/Software Engineering and Design/UML and Design Patterns/UML Class Diagrams/February 2011 (X)/Prof. Dr. E. Dubuis Page 17 of 32
18 *) See: Programming Interpretation: Single-Valued Property UML class diagram excerpt: OrderLine +price {readonly} +quantity A first, implementation-focused interpretation of property price : 1 public class OrderLine { 2 private int quantity; private Money price; 3 private Product product; public int getquantity() { return this.quantity; } 6 public void setquantity(int q) { this.quantity = q; } 7 public Money getprice() { 8 return this.price.multiply(this.quantity); 9 } 10} 1 +product Product *) Value Object: an object whose attributes cannot be changed after initialization! Returns a new Money object having the value of the base price multiplied by quantiy. BFH/TI/Software Engineering and Design/UML and Design Patterns/UML Class Diagrams/February 2011 (X)/Prof. Dr. E. Dubuis Page 18 of 32
19 Programming Interpretation: Single-Valued Property (cont'd) Another, more interface-oriented interpretation of property price : 1 public class OrderLine { 2 private int quantity; 3 private Product product; // get/set quantity as before 6 7 public Money getprice() { 8 Money priceofproduct = this.product.getprice(); 9 Money subtotal = 10 priceofpruduct. multiply(this.quantity); 11 return subtotal; 12 } 13} ==> No field for price! OrderLine +price {readonly} +quantity +price 1 Product +product BFH/TI/Software Engineering and Design/UML and Design Patterns/UML Class Diagrams/February 2011 (X)/Prof. Dr. E. Dubuis Page 19 of 32
20 Class Money: Value Object 1 public final class Money { final class means that there cannot be subclasses 2 private final BigDecimal value; final means that value can be assigned 3 only once (in the constructor) 4 public Money(BigDecimal value) { 5 if (val == null) throw new IllegalArgumentException( Value... ); 6 this.value = value; test necessary to guarantee 7 } properly initialized object 8 9 public BigDecimal getvalue() { an instance of BigDecimal is 10 return this.value; immutable 11 } 12 public Money multiply(int factor) { 13 return new Money(this.value.multiply(factor)); 14 } 15} multiplies a Money object by a factor and returns a NEW Money object BFH/TI/Software Engineering and Design/UML and Design Patterns/UML Class Diagrams/February 2011 (X)/Prof. Dr. E. Dubuis Page 20 of 32
21 Programming Interpretation: Multivalued Attributes If an attribute is multivalued, this implies that a collection is used for the values If the multiplicity of a property is ordered (with / without duplicates) the collection must be ordered: List<OrderLine>,... not duplicates (with / without order) the collection should, strictly, be unordered: Set<Order>,... but often used: List<Order>,... no arrays ( [] ), please: OrderLine[] lineitems; How many? ==> you don't know So don't use an array! (Unless there are other forces...) BFH/TI/Software Engineering and Design/UML and Design Patterns/UML Class Diagrams/February 2011 (X)/Prof. Dr. E. Dubuis Page 21 of 32
22 Programming Interpretation: Multivalued Attributes (cont'd) Multivalued properties yield a different interface to single-valued properties: 1 public class Order { 2 private List<OrderLine> lineitems = new ArrayList<OrderLine>(); 3 4 public List<OrderLine> getlineitems() 5 return Collections.unmodifiableList( 6 this.lineitems); 7 } 8 public void addlineitem(orderline item) { 9 this.lineitems.add(item); 10 } 11 public void removelineitem(orderline item) {// Option: discussed during the lecture. 12 this.lineitems.remove(item); 13 } 14} Principle: Information Hiding, i.e., the client of this class need not know which concrete implementation is used for the list. Alternatively, you may return a boolean indicating whether the underlying collection was changed or not. BFH/TI/Software Engineering and Design/UML and Design Patterns/UML Class Diagrams/February 2011 (X)/Prof. Dr. E. Dubuis Page 22 of 32
23 Bidirectional Associations Bidirectional association: A pair of properties linked together. Example: Person owner * +cars You may omit the arrows < or > or the X sign. However, you must use these signs to express navigability. Car The Car class has the property: owner : Person [0..1] The Person class has the property: cars : Car [0..*] By convention, omitting the arrows at both ends of the association is still a bidirectional association. 1 1 In UML, omitting the arrows leaves the navigability undefined. BFH/TI/Software Engineering and Design/UML and Design Patterns/UML Class Diagrams/February 2011 (X)/Prof. Dr. E. Dubuis Page 23 of 32
24 Bidirectional Associations (cont'd) You can name an association, the name is owns : Here, too: You may omit the arrows < or > or the X sign. However, you must use these signs to express navigability. Person owner owns +cars * Car BFH/TI/Software Engineering and Design/UML and Design Patterns/UML Class Diagrams/February 2011 (X)/Prof. Dr. E. Dubuis Page 24 of 32
25 Bidirectional Associations (cont'd) Implementing a bidirectional association is a little bit tricky. Key point: both properties have to be kept in sync. For example: 1 public class Car { Idea: Bidirectional association is 2 private Person owner; managed by the Car side. 3 public Person getowner() { return this.owner; } 4 5 public void setowner(person p) { 6 if (this.owner!= null) { this.owner.friendcars().remove(this); } 7 this.owner = p; 8 if (this.owner!= null) { this.owner.friendcars().add(this); } 9 } 10} BFH/TI/Software Engineering and Design/UML and Design Patterns/UML Class Diagrams/February 2011 (X)/Prof. Dr. E. Dubuis Page 25 of 32
26 Class Person looks like (assuming the same package): 1 public class Person { 2 private Set<Car> cars = new HashSet<Car>(); 3 public Set<Car> getcars() { 4 return Collections.unmodifiableSet(this.cars); 5 } 6 public void addcar(car acar) { 7 if (acar!= null &&!this.cars.contains(c)) { 8 acar.setowner(this); 9 } 10 Set<Car> friendcars() { return this.cars; } 15} Friends (here: Car objects) are allowed to update the collection of cars. Notice the visibility! If a Person instance gets a new car then the updating of the association is delegated to the Car instance. BFH/TI/Software Engineering and Design/UML and Design Patterns/UML Class Diagrams/February 2011 (X)/Prof. Dr. E. Dubuis Page 26 of 32
27 Operations Operations are the actions that a class knows to carry out. attributes -attr1 : Type1... SomeClass Format: operations visibility? name (parameter*): return-type? {property*}? +method1(p1 T1,...): Tr. Examples + getname() : String {query} # runtest (in count : int = 5) : int - op3 (inout p1 : Address) ~ op4 (out p2 String [1..*] {ordered}) : SomeType BFH/TI/Software Engineering and Design/UML and Design Patterns/UML Class Diagrams/February 2011 (X)/Prof. Dr. E. Dubuis Page 27 of 32
28 Operations (cont'd) Visibility: private: -, protected: #, package: ~, public: + Convention: If no visibility markers are given then read public visibility for operations. The name is a string. Parameter: a parameter for the operation, see below. Return-type: The type of the returned value, if there is one. Property-string: Properties of the operation. Among others, such properties are: {query} object state not changed Principle:... {modifier} object state changed Command-Query Separation Principle [B. Meyer] BFH/TI/Software Engineering and Design/UML and Design Patterns/UML Class Diagrams/February 2011 (X)/Prof. Dr. E. Dubuis Page 28 of 32
29 Operations (cont'd) Format of a parameter: direction? name: type? =default-value? no corresponding possibility in Java... The name, type, and default are the same as for attributes. direction: nothing or in : The parameter is input. out : The parameter is output: inout : The parameter is input and output. Idea: Program and use a Holder class in Java. BFH/TI/Software Engineering and Design/UML and Design Patterns/UML Class Diagrams/February 2011 (X)/Prof. Dr. E. Dubuis Page 29 of 32
30 Operations (cont'd) Modifier versus query operations, Command-Query separation principle (Betrand Meyer) modifier: changes the (observable) state of an object query: gets a value (or a collection of values) from an object without changing the state of the object Operation versus method: operation: invoked on an object (~ procedure declaration or signature) method: the operation's code or body setting/getting (getter) methods getting method: returns a value (or a collection of values) from a field / property setting method: puts a value (or a collection of values) into a field / property BFH/TI/Software Engineering and Design/UML and Design Patterns/UML Class Diagrams/February 2011 (X)/Prof. Dr. E. Dubuis Page 30 of 32
31 Generalization Order From the example above: Employee * 1 Corporate C. Customer Personal C. PersonalCustomer and CorporateCustomer have similarities (attributes, operations). The similarities can be placed in a general Customer class (the supertype). On a conceptual level, CorporateCustomer is a subtype of Customer if all instances of CorporateCustomer are also instances of Customer. CorporateCustomer is then said to be a special kind of Customer. Everything we say about a Customer associations, attributes, operations is true also for CorporateCustomer. One programming language interpretation: (implementation/class) inheritance. * 1 BFH/TI/Software Engineering and Design/UML and Design Patterns/UML Class Diagrams/February 2011 (X)/Prof. Dr. E. Dubuis Page 31 of 32
32 Generalization (cont'd) Important principle Substitutability: Important Principle: Liskov Substitution Principle (LSP) Wherever the type Customer is used in the program, an instance of CorporateCustomer can be used instead. Instances of different classes may behave differently (due to polymorphism), but the caller need not worry about this. This substitutability is also referred to as the Liskov Substitution Principle (LSP for short) BFH/TI/Software Engineering and Design/UML and Design Patterns/UML Class Diagrams/February 2011 (X)/Prof. Dr. E. Dubuis Page 32 of 32
UML Sequence Diagrams
UML Sequence Diagrams Prof. Dr. Eric Dubuis Berner Fachhochschule, @ Biel Course "UML and Design Patterns" of module "Software Engineering and Design", version October 2008 BFH/TI/Software Engineering
More informationIntroducing Design Patterns
Introducing Design Patterns Prof. Dr. Eric Dubuis Berner Fachhochschule, @ Biel Course "UML and Design Patterns" of module "Software Engineering and Design", version April 2009 (X) BFH/TI/Software Engineering
More informationSoftware Specification 2IX20
Software Specification 2IX20 Julien Schmaltz (slides from A. Serebrenik and M. Mousavi) Lecture 04: Structural specification / Class diagrams UML diagram types Classes: Chapter 11.4 of the UML standard.
More informationOn Polymorphism and the Open-Closed Principle
On Polymorphism and the Open-Closed Principle Prof. Dr. Eric Dubuis Berner Fachhochschule, @ Biel Course "UML and Design Patterns" of module "Software Engineering and Design", version March 2008 BFH/TI/Software
More informationEJB 3 Entity Relationships
Berner Fachhochschule Technik und Informatik EJB 3 Entity Relationships Course Multi Tier Business Applications with Java EE Prof. Dr. Eric Dubuis Berner Fachhochschule Biel Content What are relationships?
More informationEJB 3 Entity Relationships
Berner Fachhochschule Technik und Informatik EJB 3 Entity Relationships Course Multi Tier Business Applications with Java EE Prof. Dr. Eric Dubuis Berner Fachhochschule Biel Content What are relationships?
More informationSoftware Engineering I (02161)
Software Engineering I (02161) Week 6: Design 1: CRC cards, class and sequence diagram Assoc. Prof. Hubert Baumeister DTU Compute Technical University of Denmark Spring 2017 Contents Midterm evaluation
More informationIntroducing Design Patterns
Introducing Design Patterns Prof. Dr. Eric Dubuis, @ Biel Course "UML and Design Patterns" of module "Software Engineering and Design", version October 2007 BFH/TI/UML and Design Patterns/Software Engineering
More informationStructural specification
2IW80 Software specification and architecture Structural specification Alexander Serebrenik Before we start Time-related signal in an activity diagram is represented as a) b) c) / SET / W&I 11/02/15 PAGE
More informationSoftware Engineering I (02161)
Software Engineering I (02161) Week 5 Assoc. Prof. Hubert Baumeister DTU Compute Technical University of Denmark Spring 2015 Contents From Requirements to Design: CRC Cards Class Diagrams I Sequence Diagrams
More informationFrom Analysis to Design. LTOOD/OOAD Verified Software Systems
From Analysis to Design 1 Use Cases: Notation Overview Actor Use case System X System boundary UCBase «extend» UCExt Actor A UCVar1 UCVar2 Extending case Generalization «include» Actor B UCIncl Included
More informationSoftware Engineering I (02161)
Software Engineering I (02161) Week 5 Assoc. Prof. Hubert Baumeister DTU Compute Technical University of Denmark Spring 2018 Contents User Stories Class Diagrams I Version control User stories Requirements
More informationS T R U C T U R A L M O D E L I N G ( M O D E L I N G A S Y S T E M ' S L O G I C A L S T R U C T U R E U S I N G C L A S S E S A N D C L A S S D I A
S T R U C T U R A L M O D E L I N G ( M O D E L I N G A S Y S T E M ' S L O G I C A L S T R U C T U R E U S I N G C L A S S E S A N D C L A S S D I A G R A M S ) WHAT IS CLASS DIAGRAM? A class diagram
More informationIntroduction to OO Concepts
Introduction to OO Concepts Written by John Bell for CS 342, Fall 2018 Based on chapters 1, 2, and 10 of The Object-Oriented Thought Process by Matt Weisfeld, with additional material from UML Distilled
More informationIntroduction to Software Engineering. 5. Modeling Objects and Classes
Introduction to Software Engineering 5. Modeling Objects and Classes Roadmap > UML Overview > Classes, attributes and operations > UML Lines and Arrows > Parameterized Classes, Interfaces and Utilities
More informationCourse "UML and Design Patterns" of module "Software Engineering and Design", version November 2011
The Observer Pattern Prof. Dr. Eric Dubuis Berner Fachhochschule, @ Biel Course "UML and Design Patterns" of module "Software Engineering and Design", version November 20 BFH/TI/Software Engineering and
More informationUnified Modeling Language (UML) Class Diagram
1 / 10 Unified Modeling Language (UML) Class Diagram Miaoqing Huang University of Arkansas Spring 2010 2 / 10 Outline 1 2 3 / 10 Class Diagram Class diagrams show the static structure of the classes that
More informationOn Polymorphism and the Open-Closed Principle
Berner Fachhochschule Engineering and Information Technology On Polymorphism and the Open-Closed Principle Prof. Dr. Eric Dubuis Berner Fachhochschule, Engineering and Information Technology @ Biel Course
More informationClass Diagrams in Analysis
3.2 Subject/Topic/Focus: Introduction to Classes Summary: Conceptual Modeling Notation: Classes Associations: Multiplicity, Roles, Aggregation, Composition Generalization Objects Analysis Process Literature:
More informationInheritance. Inheritance Reserved word protected Reserved word super Overriding methods Class Hierarchies Reading for this lecture: L&L
Inheritance Inheritance Reserved word protected Reserved word super Overriding methods Class Hierarchies Reading for this lecture: L&L 9.1 9.4 1 Inheritance Inheritance allows a software developer to derive
More information02291: System Integration
02291: System Integration Week 5 Hubert Baumeister huba@dtu.dk DTU Compute Technical University of Denmark Spring 2018 Contents Components (part Ia) Class Diagrams Important Concepts Class Diagrams Software
More informationPrinciples of Software Construction: Objects, Design and Concurrency. Just enough UML. toad
Principles of Software Construction: Objects, Design and Concurrency Just enough UML 15-214 toad Christian Kästner Charlie Garrod School of Computer Science With slides from Klaus Ostermann Learning Goals
More informationUML Modeling I. Instructor: Yongjie Zheng September 3, CS 490MT/5555 Software Methods and Tools
UML Modeling I Instructor: Yongjie Zheng September 3, 2015 CS 490MT/5555 Software Methods and Tools Object-Oriented Design: Topics & Skills Rational Unified Process Unified Modeling Languages (UML) Provide
More informationComputer Science for Engineers
Computer Science for Engineers Lecture 5 Object Orientation part 3 Prof. Dr. Dr.-Ing. Jivka Ovtcharova Dipl. Wi.-Ing. Dan Gutu 27 th of November 2009 Aggregation and Composition (1) A special case of an
More informationJava Object Oriented Design. CSC207 Fall 2014
Java Object Oriented Design CSC207 Fall 2014 Design Problem Design an application where the user can draw different shapes Lines Circles Rectangles Just high level design, don t write any detailed code
More informationBanaras Hindu University
Banaras Hindu University A Course on Software Reuse by Design Patterns and Frameworks by Dr. Manjari Gupta Department of Computer Science Banaras Hindu University Lecture 5 Basic Design Patterns Basic
More informationSoftware Construction
Lecture 7: Type Hierarchy, Iteration Abstraction Software Construction in Java for HSE Moscow Tom Verhoeff Eindhoven University of Technology Department of Mathematics & Computer Science Software Engineering
More informationDay 4. COMP1006/1406 Summer M. Jason Hinek Carleton University
Day 4 COMP1006/1406 Summer 2016 M. Jason Hinek Carleton University today s agenda assignments questions about assignment 2 a quick look back constructors signatures and overloading encapsulation / information
More informationJava Fundamentals (II)
Chair of Software Engineering Languages in Depth Series: Java Programming Prof. Dr. Bertrand Meyer Java Fundamentals (II) Marco Piccioni static imports Introduced in 5.0 Imported static members of a class
More informationIntroduction to Inheritance
Introduction to Inheritance James Brucker These slides cover only the basics of inheritance. What is Inheritance? One class incorporates all the attributes and behavior from another class -- it inherits
More informationObject-Oriented Design
Software and Programming I Object-Oriented Design Roman Kontchakov / Carsten Fuhs Birkbeck, University of London Outline Discovering classes and methods Relationships between classes An object-oriented
More informationJAVA MOCK TEST JAVA MOCK TEST II
http://www.tutorialspoint.com JAVA MOCK TEST Copyright tutorialspoint.com This section presents you various set of Mock Tests related to Java Framework. You can download these sample mock tests at your
More informationIndex. Index. More information. block statements 66 y 107 Boolean 107 break 55, 68 built-in types 107
A abbreviations 17 abstract class 105 abstract data types 105 abstract method 105 abstract types 105 abstraction 92, 105 access level 37 package 114 private 115 protected 115 public 115 accessors 24, 105
More informationCOURSE 2 DESIGN PATTERNS
COURSE 2 DESIGN PATTERNS CONTENT Fundamental principles of OOP Encapsulation Inheritance Abstractisation Polymorphism [Exception Handling] Fundamental Patterns Inheritance Delegation Interface Abstract
More informationProgramming Language Concepts Object-Oriented Programming. Janyl Jumadinova 28 February, 2017
Programming Language Concepts Object-Oriented Programming Janyl Jumadinova 28 February, 2017 Three Properties of Object-Oriented Languages: Encapsulation Inheritance Dynamic method binding (polymorphism)
More informationMore on Inheritance. Interfaces & Abstract Classes
More on Inheritance Interfaces & Abstract Classes Java interfaces A Java interface is used to specify minimal functionality that a client requires of a server. A Java interface contains: method specifications
More informationAssoc. Prof. Dr. Marenglen Biba. (C) 2010 Pearson Education, Inc. All rights reserved.
Assoc. Prof. Dr. Marenglen Biba Laboratory Session: Exercises on classes Analogy to help you understand classes and their contents. Suppose you want to drive a car and make it go faster by pressing down
More informationIntroduction to UML Diagrams
Bern University of Applied Sciences H T I Bienne Department I Basic Programming Introduction to UML Diagrams J.-P. Dubois Content State Machine Diagrams Class Diagrams Object Diagrams Sequence Diagrams
More informationUML (Unified Modeling Language)
UML (Unified Modeling Language) UML Outline Software Institute of Nanjing University 2009 Instructor 刘嘉 (Liu Jia) Email : liujia@software.nju.edu.cn ext : 509 Office : 705 2 References [1] The Unified
More informationType Hierarchy. Comp-303 : Programming Techniques Lecture 9. Alexandre Denault Computer Science McGill University Winter 2004
Type Hierarchy Comp-303 : Programming Techniques Lecture 9 Alexandre Denault Computer Science McGill University Winter 2004 February 16, 2004 Lecture 9 Comp 303 : Programming Techniques Page 1 Last lecture...
More informationClass diagrams. Modeling with UML Chapter 2, part 2. Class Diagrams: details. Class diagram for a simple watch
Class diagrams Modeling with UML Chapter 2, part 2 CS 4354 Summer II 2015 Jill Seaman Used to describe the internal structure of the system. Also used to describe the application domain. They describe
More informationIntroduction to Computing II (ITI 1121) Midterm Examination
Introduction to Computing II (ITI 1121) Midterm Examination Instructor: Marcel Turcotte March 2014, duration: 2 hours Identification Surname: Given name: Student number: Instructions 1. This is a closed
More informationCS112 Lecture: Defining Instantiable Classes
CS112 Lecture: Defining Instantiable Classes Last revised 2/3/05 Objectives: 1. To describe the process of defining an instantiable class 2. To discuss public and private visibility modifiers. Materials:
More informationCS-202 Introduction to Object Oriented Programming
CS-202 Introduction to Object Oriented Programming California State University, Los Angeles Computer Science Department Lecture III Inheritance and Polymorphism Introduction to Inheritance Introduction
More informationCH. 2 OBJECT-ORIENTED PROGRAMMING
CH. 2 OBJECT-ORIENTED PROGRAMMING ACKNOWLEDGEMENT: THESE SLIDES ARE ADAPTED FROM SLIDES PROVIDED WITH DATA STRUCTURES AND ALGORITHMS IN JAVA, GOODRICH, TAMASSIA AND GOLDWASSER (WILEY 2016) OBJECT-ORIENTED
More informationObject-Oriented Analysis, Design and Implementation. Case Study Part II
Object-Oriented Analysis, Design and Implementation Case Study Part II Assoc. Prof. Marenglen Biba MSc in Computer Science, UoG-UNYT Foundation Programme (C) 2010 Pearson Education, Inc. All 3-1 Further
More informationReadings for This Lecture
Lecture 4 Classes Readings for This Lecture Section 1.4, 1.5 in text Section 3.1 in text Plive activities referenced in the text Please look at lecture summaries online Handouts are short version Presentation
More informationPROCESS DEVELOPMENT METHODOLOGY The development process of an API fits the most fundamental iterative code development
INTRODUCING API DESIGN PRINCIPLES IN CS2 Jaime Niño Computer Science, University of New Orleans New Orleans, LA 70148 504-280-7362 jaime@cs.uno.edu ABSTRACT CS2 provides a great opportunity to teach an
More informationThe Unified Modeling Language (UML)
The Unified Modeling Language (UML) A Very Distilled Introduction to The Unified Modeling Language (UML). A quick introduction to UML is given. Thereafter, the surface of class and activity diagrams and
More informationThe Essence of Object Oriented Programming with Java and UML. Chapter 2. The Essence of Objects. What Is an Object-Oriented System?
Page 1 of 21 Page 2 of 21 and identity. Objects are members of a class, and the attributes and behavior of an object are defined by the class definition. The Essence of Object Oriented Programming with
More informationOBJECT ORIENTED DESIGN with the Unified Process. Use Case Realization
OBJECT ORIENTED DESIGN with the Unified Process Use Case Realization Objectives Explain the purpose and objectives of objectoriented design Develop design class diagrams Develop detailed sequence diagrams
More informationChapter 11 Object and Object- Relational Databases
Chapter 11 Object and Object- Relational Databases Copyright 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 11 Outline Overview of Object Database Concepts Object-Relational
More informationSoftware Service Engineering
Software Service Engineering Lecture 4: Unified Modeling Language Doctor Guangyu Gao Some contents and notes selected from Fowler, M. UML Distilled, 3rd edition. Addison-Wesley Unified Modeling Language
More informationObjectives. Explain the purpose and objectives of objectoriented. Develop design class diagrams
Objectives Explain the purpose and objectives of objectoriented design Develop design class diagrams Develop interaction diagrams based on the principles of object responsibility and use case controllers
More informationInheritance (IS A Relationship)
Inheritance (IS A Relationship) We've talked about the basic idea of inheritance before, but we haven't yet seen how to implement it. Inheritance encapsulates the IS A Relationship. A String IS A Object.
More informationPrinciples of Object Oriented Programming. Lecture 4
Principles of Object Oriented Programming Lecture 4 Object-Oriented Programming There are several concepts underlying OOP: Abstract Types (Classes) Encapsulation (or Information Hiding) Polymorphism Inheritance
More informationChapter 6 Introduction to Defining Classes
Introduction to Defining Classes Fundamentals of Java: AP Computer Science Essentials, 4th Edition 1 Objectives Design and implement a simple class from user requirements. Organize a program in terms of
More informationObjects and Classes. Lecture 10 of TDA 540 (Objektorienterad Programmering) Chalmers University of Technology Gothenburg University Fall 2017
Objects and Classes Lecture 10 of TDA 540 (Objektorienterad Programmering) Carlo A. Furia Alex Gerdes Chalmers University of Technology Gothenburg University Fall 2017 All labs have been published Descriptions
More informationJava How to Program, 10/e. Copyright by Pearson Education, Inc. All Rights Reserved.
Java How to Program, 10/e Education, Inc. All Rights Reserved. Each class you create becomes a new type that can be used to declare variables and create objects. You can declare new classes as needed;
More informationCSCU9T4: Managing Information
CSCU9T4: Managing Information CSCU9T4 Spring 2016 1 The Module Module co-ordinator: Dr Gabriela Ochoa Lectures by: Prof Leslie Smith (l.s.smith@cs.stir.ac.uk) and Dr Nadarajen Veerapen (nve@cs.stir.ac.uk)
More informationCIS 110: Introduction to computer programming
CIS 110: Introduction to computer programming Lecture 25 Inheritance and polymorphism ( 9) 12/3/2011 CIS 110 (11fa) - University of Pennsylvania 1 Outline Inheritance Polymorphism Interfaces 12/3/2011
More informationCS112 Lecture: Defining Classes. 1. To describe the process of defining an instantiable class
CS112 Lecture: Defining Classes Last revised 2/3/06 Objectives: 1. To describe the process of defining an instantiable class Materials: 1. BlueJ SavingsAccount example project 2. Handout of code for SavingsAccount
More informationCredit where Credit is Due. Lecture 25: Refactoring. Goals for this lecture. Last Lecture
Credit where Credit is Due Lecture 25: Refactoring Kenneth M. Anderson Object-Oriented Analysis and Design CSCI 6448 - Spring Semester, 2002 Some of the material for this lecture and lecture 26 is taken
More informationC++ Inheritance and Encapsulation
C++ Inheritance and Encapsulation Private and Protected members Inheritance Type Public Inheritance Private Inheritance Protected Inheritance Special method inheritance 1 Private Members Private members
More informationVIRTUAL FUNCTIONS Chapter 10
1 VIRTUAL FUNCTIONS Chapter 10 OBJECTIVES Polymorphism in C++ Pointers to derived classes Important point on inheritance Introduction to virtual functions Virtual destructors More about virtual functions
More informationTutorial notes on. Object relational structural patterns
Tutorial notes on Object relational structural patterns Dr. C. Constantinides, P.Eng. Computer Science and Software Engineering Concordia University Page 1 of 14 Exercise 1. a) Briefly describe what is
More informationBasic Object-Oriented Concepts. 5-Oct-17
Basic Object-Oriented Concepts 5-Oct-17 Concept: An object has behaviors In old style programming, you had: data, which was completely passive functions, which could manipulate any data An object contains
More informationC++ Modern and Lucid C++ for Professional Programmers
Informatik C++ Modern and Lucid C++ for Professional Programmers part 13 Prof. Peter Sommerlad Institutsleiter IFS Institute for Software Rapperswil, HS 2015 Inheritance and dynamic Polymorphism base classes,
More informationCREATED BY: Muhammad Bilal Arslan Ahmad Shaad. JAVA Chapter No 5. Instructor: Muhammad Naveed
CREATED BY: Muhammad Bilal Arslan Ahmad Shaad JAVA Chapter No 5 Instructor: Muhammad Naveed Muhammad Bilal Arslan Ahmad Shaad Chapter No 5 Object Oriented Programming Q: Explain subclass and inheritance?
More informationJava: introduction to object-oriented features
Chair of Software Engineering Carlo A. Furia, Marco Piccioni, Bertrand Meyer Java: introduction to object-oriented features Chair of Software Engineering Carlo A. Furia, Marco Piccioni, Bertrand Meyer
More informationImplementation. (Mapping to Java) Jörg Kienzle & Alfred Strohmeier. COMP-533 Implementation
Implementation (Mapping to Java) Jörg Kienzle & Alfred Strohmeier COMP-533 Implementation Datatype Enumeration Class Attribute Association Inheritance Method Visibility Collections Overview 2 Data Type
More informationCOMP 401 Spring 2013 Midterm 1
COMP 401 Spring 2013 Midterm 1 I have not received nor given any unauthorized assistance in completing this exam. Signature: Name: PID: Please be sure to put your PID at the top of each page. This page
More informationAlgorithms and Programming
Algorithms and Programming Lecture 6 Classes, UML, NumPy Camelia Chira Course content Introduction in the software development process Procedural programming Modular programming Abstract data types Software
More informationChapter 13 Abstract Classes and Interfaces
Chapter 13 Abstract Classes and Interfaces 1 Abstract Classes Abstraction is to extract common behaviors/properties into a higher level in the class hierarch so that they are shared (implemented) by subclasses
More informationType Hierarchy. Lecture 6: OOP, autumn 2003
Type Hierarchy Lecture 6: OOP, autumn 2003 The idea Many types have common behavior => type families share common behavior organized into a hierarchy Most common on the top - supertypes Most specific at
More informationLecturer: Sebastian Coope Ashton Building, Room G.18 COMP 201 web-page:
Lecturer: Sebastian Coope Ashton Building, Room G.18 E-mail: coopes@liverpool.ac.uk COMP 201 web-page: http://www.csc.liv.ac.uk/~coopes/comp201 Lecture 17 Concepts of Object Oriented Design Object-Oriented
More informationWeiss Chapter 1 terminology (parenthesized numbers are page numbers)
Weiss Chapter 1 terminology (parenthesized numbers are page numbers) assignment operators In Java, used to alter the value of a variable. These operators include =, +=, -=, *=, and /=. (9) autoincrement
More informationCopyright 2016 Ramez Elmasri and Shamkant B. Navathe
Chapter 12 Outline Overview of Object Database Concepts Object-Relational Features Object Database Extensions to SQL ODMG Object Model and the Object Definition Language ODL Object Database Conceptual
More informationUML & OO FUNDAMENTALS CSCI 4448/5448: OBJECT-ORIENTED ANALYSIS & DESIGN LECTURE 3 08/30/2011
UML & OO FUNDAMENTALS CSCI 4448/5448: OBJECT-ORIENTED ANALYSIS & DESIGN LECTURE 3 08/30/2011 1 Goals of the Lecture Review the material in Chapter 2 of the Textbook Cover key parts of the UML notation
More informationEMF Temporality. Jean-Claude Coté Éric Ladouceur
EMF Temporality Jean-Claude Coté Éric Ladouceur 1 Introduction... 3 1.1 Dimensions of Time... 3 3 Proposed EMF implementation... 4 3.1 Modeled Persistence... 4 3.2 Modeled Temporal API... 5 3.2.1 Temporal
More informationPatterns in Software Engineering
Patterns in Software Engineering Lecturer: Raman Ramsin Lecture 19 Analysis Patterns Part 2 1 Supporting Patterns The supporting patterns describe how to take analysis patterns and apply them: Layered
More informationObjects and Classes. Amirishetty Anjan Kumar. November 27, Computer Science and Engineering Indian Institue of Technology Bombay
Computer Science and Engineering Indian Institue of Technology Bombay November 27, 2004 What is Object Oriented Programming? Identifying objects and assigning responsibilities to these objects. Objects
More informationChapter 5 Object-Oriented Programming
Chapter 5 Object-Oriented Programming Develop code that implements tight encapsulation, loose coupling, and high cohesion Develop code that demonstrates the use of polymorphism Develop code that declares
More informationCS 1302 Chapter 9 (Review) Object & Classes
CS 1302 Chapter 9 (Review) Object & Classes Reference Sections 9.2-9.5, 9.7-9.14 9.2 Defining Classes for Objects 1. A class is a blueprint (or template) for creating objects. A class defines the state
More information2.1 Introduction UML Preliminaries Class diagrams Modelling delegation... 4
Department of Computer Science COS121 Lecture Notes Chapter 2- Memento design pattern Copyright c 2015 by Linda Marshall and Vreda Pieterse. All rights reserved. Contents 2.1 Introduction.................................
More informationChapter 4 Defining Classes I
Chapter 4 Defining Classes I This chapter introduces the idea that students can create their own classes and therefore their own objects. Introduced is the idea of methods and instance variables as the
More informationLearning Objectives. C++ For Artists 2003 Rick Miller All Rights Reserved xli
Identify and overcome the difficulties encountered by students when learning how to program List and explain the software development roles played by students List and explain the phases of the tight spiral
More informationToday's Agenda. References. Open Closed Principle. CS 247: Software Engineering Principles. Object-Oriented Design Principles
CS 247: Software Engineering Principles Reading: none Object-Oriented Design Principles Today's Agenda Object-Oriented Design Principles - characteristics, properties, and advice for making decisions that
More informationSubclassing for ADTs Implementation
Object-Oriented Design Lecture 8 CS 3500 Fall 2009 (Pucella) Tuesday, Oct 6, 2009 Subclassing for ADTs Implementation An interesting use of subclassing is to implement some forms of ADTs more cleanly,
More informationSoftware Engineering I (02161)
Software Engineering I (02161) Week 2: Class diagrams part 1 Hubert Baumeister Informatics and Mathematical Modelling Technical University of Denmark Spring 2010 c 2010 H. Baumeister (IMM) Software Engineering
More informationInheritance. A key OOP concept
Inheritance A key OOP concept Setting the scene Why do we need inheritance? Inheritance enables you to define a new class based upon an existing class. The new class is similar to the existing class, but
More informationProgramming II (CS300)
1 Programming II (CS300) Chapter 03: Creating Classes MOUNA KACEM mouna@cs.wisc.edu Spring 2019 Creating Classes 2 Constructors and Object Initialization Static versus non-static fields/methods Encapsulation
More informationMechEng SE3 Lecture 7 Domain Modelling
MechEng SE3 Lecture 7 Domain Modelling Simon Gay (slides by Phil Gray) 17 February 2010 1 This week s supplementary reading Zero Balances and Zero Responsibility Michael Bolton http://www.developsense.com/essays/zero.html
More informationObject Oriented Programming is a programming method that combines: Advantage of Object Oriented Programming
Overview of OOP Object Oriented Programming is a programming method that combines: a) Data b) Instructions for processing that data into a self-sufficient object that can be used within a program or in
More informationObjects and Classes. 1 Creating Classes and Objects. CSCI-UA 101 Objects and Classes
Based on Introduction to Java Programming, Y. Daniel Liang, Brief Version, 10/E 1 Creating Classes and Objects Classes give us a way of defining custom data types and associating data with operations on
More informationWeek 9 Implementation
Week 9 Implementation Dr. Eliane l. Bodanese What is more important From a software engineering perspective: Good Gui? does what customer wants maintainable, extensible, reusable Commented Code? how is
More informationObject Oriented Programming: Based on slides from Skrien Chapter 2
Object Oriented Programming: A Review Based on slides from Skrien Chapter 2 Object-Oriented Programming (OOP) Solution expressed as a set of communicating objects An object encapsulates the behavior and
More information02291: System Integration
02291: System Integration Week 5 Hubert Baumeister huba@dtu.dk DTU Compute Technical University of Denmark Spring 2017 Contents Object-orientation: Centralized vs Decentralized Control/Computation Class
More informationSoftware Engineering Fall 2015 (CSC 4350/6350) TR. 5:30 pm 7:15 pm. Rao Casturi 11/03/2015
Software Engineering Fall 2015 (CSC 4350/6350) TR. 5:30 pm 7:15 pm Rao Casturi 11/03/2015 http://cs.gsu.edu/~ncasturi1 Object Design Software Engineering -CSC4350/6350 - Rao Casturi 2 Object Design Close
More informationProgramming II (CS300)
1 Programming II (CS300) Chapter 03: Creating Classes MOUNA KACEM mouna@cs.wisc.edu Spring 2018 Creating Classes 2 Constructors and Object Initialization Static versus non-static fields/methods Encapsulation
More information