Docsity

Identify Classes - Object Oriented Programming - Lecture Slides, Slides of Object Oriented Programming

Partial preview of the text

Download Identify Classes - Object Oriented Programming - Lecture Slides and more Slides Object Oriented Programming in PDF only on Docsity!

Object-Oriented Modeling

An Example

Problem Statement

  • Develop a graphic editor that can draw different geometric shapes such as line, circle and triangle. User can select, move or rotate a shape. To do so, editor provides user with a menu listing different commands. Individual shapes can be grouped together and can behave as a single shape.

…Identify Classes

Eliminate irrelevant classes

  • Editor – Very broad scope
  • User – Out of system boundary

…Identify Classes

Add classes by analyzing requirements

  • Group – required to behave as a shape
    • “Individual shapes can be grouped together and can behave as a single shape”
  • View – editor must have a display area

Object Model – Graphic Editor

Line

Circle

Triangle

Shape Group

View

Menu

Identify Associations

Extract verbs connecting objects

  • “Individual shapes can be grouped together” - Group consists of lines, circles, triangles - Group can also consists of other groups (Composition)

… Identify Associations

Verify access paths

  • Menu sends message to View

(Simple One-Way Association)

Object Model – Graphic Editor

Line Circle Triangle

View Shape

nn nn^ nn

nn

Menu

Group nn nn^ nn

nn

nn

…Identify Attributes

Extract properties of the object

  • From the domain knowledge
  • Line
  • Color
  • Vertices
  • Length
  • Circle
  • Color
  • Vertices
  • Radius
  • Triangle
  • Color
  • Vertices
  • Angle
  • Shape
  • Color
  • Vertices

…Identify Attributes

Extract properties of the object

  • From the domain knowledge
  • Group
  • noOfObjects
  • View
  • noOfObjects
  • selected
  • Menu
  • Name
  • isOpen

Identify Operations

Extract verbs connected with an object

  • Develop a graphic editor that can draw different geometric shapes such as line, circle and triangle. User can select, move or rotate a shape. To do so, editor provides user with a menu listing different commands. Individual shapes can be grouped together and can behave as a single shape.

… Identify Operations

Eliminate irrelevant operations

  • Develop – out of system boundary
  • Behave – have broad semantics

…Identify Operations

Following are selected operations:

  • Triangle
    • Draw
    • Select
    • Move
    • Rotate
      • Shape
        • Draw
        • Select
        • Move
        • Rotate

…Identify Operations

Following are selected operations:

  • Group
    • Draw
    • Select
    • Move
    • Rotate
      • Menu
        • Open
        • Select
        • Move
        • Rotate