Tuesday, 5 February 2013

Representing Objects


  • When an object is instantiated from a class definition it will contain a specific value for each of its attributes
  • In the UML, an object name should start with a lowercase letter and be separated from its class name with a single colon
  • The name of the object bis also underlined to emphasis the fact that it is an object

Representing Behavior


  • A class behavior defines something the class can do or that can be done with the class
  • Behavior names should follow the same conventions used for attribute names except that a pair of parenthesis is included after the name
  • The parameter name and types as well as the return type for each behavior can be specified
  • These pieces of information concerning a behavior make up the behavior's signature

Representing Attributes


  • A class may have zero or more attributes
  • Attributes represent the properties or important pieces of data that each object of the class must hold
  • Attribute names in the UML should begin with a lowercase letter
  • If an attribute name consists of more than one word then the words should be combined together capitalizing the first letter of each new word
  • The list of a class's attributes is separated from the class name by a solid line.

Packages


  • The UML also uses the concept of packages to organize the various elements on a diagram
  • if a class belongs to a package it can impact on the way the class is named

Representing CLASSES


  • A rectangle symbol is used to represent a class in the UML
  • The name given to a class should start with a capital letter
  • If the name of the class consists of more than one word then each word should be combined into one capitalizing the first letter of each new word

Visualizing Classes


  • The UML uses a specific notation for representing classes in its diagrams
  • This notation defines how a class is represented in terms of its:
    • Class name
    • attribute
    • behaviors
    • responsibilities
    • cibstraints
  • It also define how notes can be attached to classes on a UML diagram

Aggregation


  • An aggregation is formed when an object contains one or more other objects
  • An example might be a computer system which contains a CPU object a hard disk object a keyboard object etc
  • One special form of aggregation is referred to as composition
  • Composition is found where the components of an object only exist within the one composite object
  • For example a finger belong to just one hand. Therefore it can be said that the hand finger relationship is a composite relationship