1 / 36

Object-Oriented Programming (Java), Unit 16

Object-Oriented Programming (Java), Unit 16. Kirk Scott. Simple UML with Visio. 16.1 Static Structure Diagrams for Classes and Objects 16.2 Association, Aggregation, and Composition 16.3 Inheritance, Interfaces, and Inner Classes 16.4 Sequence Diagrams.

Download Presentation

Object-Oriented Programming (Java), Unit 16

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


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

  2. Simple UML with Visio • 16.1 Static Structure Diagrams for Classes and Objects • 16.2 Association, Aggregation, and Composition • 16.3 Inheritance, Interfaces, and Inner Classes • 16.4 Sequence Diagrams

  3. 16.1 Static Structure Diagrams for Classes and Objects

  4. 16.1.1 Classes • Name, attributes, and operations

  5. 16.1.2 Objects • Name, name of class, attribute values

  6. 16.1.3 Instances of Classes

  7. 16.2 Association, Aggregation, and Composition

  8. 16.2.1 Binary Associations • Any kind of relationship • Implemented in any way • Cardinality, navigability, labeling

  9. 16.2.2 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

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

  11. 16.3 Inheritance, Interfaces, and Inner Classes

  12. 16.3.1 Inheritance • Subclasses refer to their superclasses

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

  14. GuillemetsFrom Wikipedia, the free encyclopedia  (Redirected from 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. • 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.

  15. GuillemotFrom Wikipedia, the free encyclopediaJump to: navigation, searchFor other uses, see Guillemot (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] • The Uria are known as murres in North America and, together with the Razorbill, Dovekie and the extinctGreat 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. • 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.

  16. 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 1672 • 1British: a common murre (Uria aalge)2: any of a genus (Cepphus) of narrow-billed auks of northern seas

  17. A Common Guillemot Between Two Brunnich’s Guillemots

  18. The Pigeon Guillemot

  19. The Ancient Murrelet

  20. The Marbled Murrelet

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

  22. 16.3.3 Inner Classes • This is the official notation.

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

  24. 16.4 Sequence Diagrams

  25. 16.4.1 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

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

  27. Calling a method within the same class

  28. 16.4.2 A Larger Sequence Diagram ExampleLet 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; • } • …

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

  30. 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; • } • }

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

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

  33. The End

More Related