1 / 11

An Introduction to UML

An Introduction to UML. COMS 103 section 4 13 January, 1999. Review. UML is a graphical “design” language. Symbols in UML have certain meanings. “Class” is a rectangle with three parts: Name Variables or Attributes Methods. Review (continued).

lori
Download Presentation

An Introduction to UML

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. An Introduction to UML COMS 103 section 4 13 January, 1999

  2. Review • UML is a graphical “design” language. • Symbols in UML have certain meanings. • “Class” is a rectangle with three parts: • Name • Variables or Attributes • Methods

  3. Review (continued) • Classes have different types of “relationships” • Associations: existence-independent • Dependency: using-relationship • Aggregate: part-of, has, or whole-part

  4. Inheritance Relationships • Define new classes in terms of old classes • This can be a labor-saving mechanism • Sometimes called an “is-a” relationship • Example: • Consider a “computer system” • Refine to a pentium-class computer system • Refine further to a pentium II or Celeron

  5. Inheritance Example Diagram Simulate Computer Operation Computer System Pentium-Class System Macintosh Pentium II Celeron

  6. Inheritance Terminology • Parent/Child • Ancestor/descendent • Superclass/Subclass • Generalization/Specialization • Arrows point toward the more general class • “Inherit” is a verb, as in: • class A inherits from class B • “Inherited” is an adjective, as in: • method doit() is inherited from class B

  7. Inheritance Notation • class superclass { void m1(); } • class subclass extend superclass { void m2(); } • Instance creation: • superclass s1 = new superclass(); • subclass s2 = new subclass(); • Reference: • s2.m1(); • s2.m2();

  8. Overriding Superclass Names Pentium-class doInstruction(int i) • Use Same Name • “super” notation void m1() { super.m1(); // other m1 work } Pentium-II doInstruction(int i)

  9. Inheritance Example Diagram Computer System Pentium-Class System doInstruction() Macintosh Pentium II doInstruction() Celeron doInstruction()

  10. Which “Relationship” to use? • Use Aggregate when creating an instance of one class without the other doesn’t make sense. • Use Dependency when one class provides a service to the other. • Use Association when neither class depends upon the other, but there is a relationship. • Use Inheritance when one class is a special case of the other.

  11. Relationship Notation Review • Aggregate: • Dependency: • Association: • Inheritance:

More Related