1 Object-Oriented Programming (Java), Unit 15 Kirk Scott.

Slides:



Advertisements
Similar presentations
Stereotypes Stereotypes provide the capability to create a new kind of modeling element. –They can be used to classify or mark modeling elements. –A type.
Advertisements

Inheritance Inheritance Reserved word protected Reserved word super
UML Class and Sequence Diagrams Violet Slides adapted from Marty Stepp, CSE 403, Winter 2012 CSE 403 Spring 2012 Anton Osobov.
Objects and Classes OO model an approximate interpretation of real world – Objects represent real world entities which have identities, states and behaviors.
2-1 © Prentice Hall, 2007 Chapter 2: Introduction to Object Orientation Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph.
UML – Class Diagrams.
Inheritance. Extending Classes It’s possible to create a class by using another as a starting point  i.e. Start with the original class then add methods,
Design Patterns in Java Appendix D UML at a Glance Summary prepared by Kirk Scott 1.
Essentials of interaction diagrams Lecture Outline Collaborations Interaction on collaboration diagrams Sequence diagrams Messages from an object.
What is UML? A modeling language standardized by the OMG (Object Management Group), and widely used in OO analysis and design A modeling language is a.
7M701 1 Class Diagram advanced concepts. 7M701 2 Characteristics of Object Oriented Design (OOD) objectData and operations (functions) are combined 
Unified Modeling Language (UML)
Practical Object-Oriented Design with UML 2e Slide 1/1 ©The McGraw-Hill Companies, 2004 Class and Object Diagrams PRACTICAL OBJECT-ORIENTED DESIGN WITH.
UML Class Diagram: class Rectangle
2-1 © Prentice Hall, 2004 Chapter 2: Introduction to Object Orientation (Adapted) Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra,
1 Object-Oriented Modeling Using UML CS 3331 Fall 2009.
Object-oriented design Part 4: More UML. Interfaces An interface is a language construct specific to Java Java does not support multiple inheritance Interfaces.
Unified Modeling Language
Object-Oriented Analysis and Design
1 Object-Oriented Programming (Java), Unit 15 Kirk Scott.
1 Object-Oriented Programming (Java), Unit 13 Kirk Scott.
Practical Object-Oriented Design with UML 2e Slide 1/1 ©The McGraw-Hill Companies, 2004 PRACTICAL OBJECT-ORIENTED DESIGN WITH UML 2e Chapter 2: Modelling.
Chapter 11 Inheritance and Composition. Chapter Objectives Learn about inheritance Learn about subclasses and superclasses Explore how to override the.
1 ER Modeling BUAD/American University Entity Relationship (ER) Modeling.
1 Java Inheritance. 2 Inheritance On the surface, inheritance is a code re-use issue. –we can extend code that is already written in a manageable manner.
Practical Object-Oriented Design with UML 2e Slide 1/1 ©The McGraw-Hill Companies, 2004 PRACTICAL OBJECT-ORIENTED DESIGN WITH UML 2e Chapter 9: Interaction.
Object-Oriented Software Engineering Practical Software Development using UML and Java Chapter 5: Modelling with Classes.
Chris Kiekintveld CS 2401 (Fall 2010) Elementary Data Structures and Algorithms Inheritance and Polymorphism.
Chapter 16 Applying UML and Patterns Craig Larman
® IBM Software Group © 2006 IBM Corporation Rational Software France Object-Oriented Analysis and Design with UML2 and Rational Software Modeler 03. Classes,
NJIT UML Class Diagrams Chapter 16 Applying UML and Patterns Craig Larman.
UML The Unified Modeling Language A Practical Introduction Al-Ayham Saleh Aleppo University
Object Oriented Software Development
Copyright (c) 1998, 1999 D.L. Bailey * Winter 1999 Part 6 Reusing Classes: Inheritance and Composition.
2007ACS-3913 Ron McFadyen1 Class Diagram See Schaum’s UML Outline, especially chapters 4, 5, 6, 7.
Appendix D UML at a Glance Summary prepared by Kirk Scott 1.
Class and Sequence diagrams UML notation SE-2030 Dr. Mark L. Hornick 1.
Design Model Lecture p6 T120B pavasario sem.
Object Oriented Analysis and Design Class and Object Diagrams.
CSCI-383 Object-Oriented Programming & Design Lecture 10.
1 Kyung Hee University Modeling with Objects Spring 2001.
CS212: Object Oriented Analysis and Design Lecture 33: Class and Sequence Diagram.
UML Class Diagram notation Indicating relationships between classes SE-2030 Dr. Mark L. Hornick 1.
Chapter 16 UML Class Diagrams 1CS6359 Fall 2012 John Cole.
Chapter 16 UML Class Diagrams.
INFSY 535.  Small systems  Larger systems 1.Understand the program requirement- what 3. Write and test each part (unit testing) 4. Maintenance 2. Specify.
Chapter 3: Introducing the UML
Object Modeling THETOPPERSWAY.COM. Object Modelling Technique(OMT)  Building a model of an application domain and then adding implementation.
ITEC0724 Modern Related Technology on Mobile Devices Lecture Notes #2 1.
Class Diagram Lecture # 1. Class diagram A Class Diagram is a diagram describing the structure of a system shows the system's classes Attributes operations.
TK2023 Object-Oriented Software Engineering CHAPTER 11 CLASS DIAGRAMS.
BTS430 Systems Analysis and Design using UML Design Class Diagrams (ref=chapter 16 of Applying UML and Patterns)
Class Diagrams Revisited. Parameterized Classes Parameterized Classes - are used to represent relationships between templates.
SUBCLASSES - JAVA. The Purpose of Subclasses Class Farm String getOwner() void setOwner(String s) int getSize() void setSize(int s) Class DairyFarm String.
UML Review – class diagrams SE-2030 Dr. Mark L. Hornick 1.
Java Programming: Guided Learning with Early Objects Chapter 9 Inheritance and Polymorphism.
2-1 © Prentice Hall, 2004 Chapter 2: Introduction to Object Orientation Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph.
COP 3330 Notes 4/13. Today’s Topics UML Class Diagrams.
Unified Modeling Language
Chapter 16 UML Class Diagrams.
Interface, Subclass, and Abstract Class Review
Object-Oriented Programming (Java), Unit 13
Object-Oriented Programming (Java), Unit 16
UML Class Diagram: class Rectangle
Software Engineering Lecture #11.
CIS 375 Bruce R. Maxim UM-Dearborn
CIS 375 Bruce R. Maxim UM-Dearborn
Object Oriented System Design Class Diagrams
The generalization of class
Warmup Which of the 4 sorting algorithms uses recursion?
Presentation transcript:

1 Object-Oriented Programming (Java), Unit 15 Kirk Scott

2 Simple UML with Visio 15.1 Static Structure Diagrams for Classes and Objects 15.2 Inheritance, Interfaces, and Inner Classes 15.3 Association, Aggregation, and Composition 15.4 Sequence Diagrams

Static Structure Diagrams for Classes and Objects

Classes Name, attributes, and operations, return types, (parameters) + and – equal public and private

Objects Name of object, name of class, attribute values

Instances of Classes

Inheritance, Interfaces, and Inner Classes

Inheritance Subclasses refer to their superclasses

Interfaces “realizes” in European quotation marks may be added as a label.

Guillemets From Wikipedia, the free encyclopedia (Redirected from Guillemet)Guillemet Guillemets (pronounced / ˈɡɪ ləm ɛ t/, or / ɡ i ː ə ˈ me ɪ / after French [ ɡ ij(ə)m ɛ ]), also called angle quotes, are line segments, pointed as if arrows (« or »), sometimes forming a complementary set of punctuation marks used as a form of quotation mark. The symbol at either end – double « and » or single ‹ and › – is a guillemet. They are used in a number of languages to indicate speech. They are also used as symbols for rewind and fast forward./ ˈɡɪ ləm ɛ t// ɡ i ː ə ˈ me ɪ / [ ɡ ij(ə)m ɛ ]angle quotesquotation markrewindfast forward Etymology The word is a diminutive of the French name Guillaume (whose equivalent in English is William), after the French printer and punchcutter Guillaume le Bé (1525–1598). [1][2] Some languages derive their word for guillemets analogously; for example, the Irish term is Liamóg, from Liam 'William' and a diminutive suffix.diminutiveGuillaume le Bé [1][2]Irish 10

Guillemot From Wikipedia, the free encyclopedia Jump to: navigation, search For other uses, see Guillemot (disambiguation).navigationsearchGuillemot (disambiguation) Guillemot is the common name for several species of seabird in the order Charadriiformes, and the auk family, comprising two genera: Uria and Cepphus. This word of French origin apparently derives from a form of the name William, cf. the Welsh: Gwillim or the French: Guillaume. [1]common nameseabirdCharadriiformesauk UriaCepphusWilliamWelsh French [1] The Uria are known as murres in North America and, together with the Razorbill, Dovekie and the extinct Great Auk, make up the tribe Alcini. They have distinctly white bellies, thicker, longer bills than Cepphus and form very dense colonies on cliffs during the reproductive season.RazorbillDovekieextinctGreat Auktribe The three species of Cepphus - for which the term "guillemot" is generally reserved in North America - form a tribe of their own: Cepphini. They are smaller than the Uria species, have black bellies, rounder heads and bright red feet. 11

Merriam-Webster’s Online Dictionary Main Entry: guil·le·mot Pronunciation: \ ˈ gi-lə- ˌ mät\ Function: noun Etymology: French, from Middle French, diminutive of Guillaume William Date: circa British : a common murre (Uria aalge) 2 : any of a genus (Cepphus) of narrow- billed auks of northern seas 12

A Common Guillemot Between Two Brunnich’s Guillemots 13

Brunnich’s Guillemot 14

The Pigeon Guillemot 15

The Ancient Murrelet 16

The Marbled Murrelet 17

Mother Carey’s Chicken 18

19 If the interface is given in full elsewhere this notation can save lines in the diagram.

Inner Classes This is the official notation.

21 This is the nearest equivalent I could find in Visio.

Association, Aggregation, and Composition

Binary Associations Any kind of relationship Implemented in any way Cardinality, navigability, labeling

Aggregations “has-a” relationship = whole to parts relationship May be expressed using a verb more specific than “has” Cardinality May be labeled on both ends

25

Compositions Like an aggregation, except that the whole cannot exist without the part(s)

27

Sequence Diagrams

Sequence Diagrams Objects, lifelines, activation rectangles Message passing = calling methods and returning Although not shown in these examples, messages may be labeled to specify parameters and return values

30 A call of a method on one object, which triggers a second call:

31 Calling a method within the same class

A Larger Sequence Diagram Example Let this code be given: public abstract class Food { private String brand; private String productName; private String units; … public void setBrand(String brandIn) { brand = brandIn; } public String getBrand() { return brand; } …

33 public void setBrandToThisBrand(Food anotherFood) { String tempBrand = anotherFood.getBrand(); setBrand(tempBrand); } … public abstract double getUnitCost(); }

34 public class PackagedFood extends Food { private double size; private double itemCost; … public void setSize(double sizeIn) { size = sizeIn; } public double getSize() { return size; } … public double getUnitCost() { return itemCost / size; }

35 Suppose the following is done in a calling program: PackagedFood myfood = new PackagedFood(…); PackagedFood yourfood = new PackagedFood(…); …

36 Suppose this call is then made: myfood.setBrandToThisBrand(yourfood); The corresponding sequence diagram is shown on the next overhead.

37

38 The End