Software Design by ewghwehws

VIEWS: 5 PAGES: 25

									            ECE450
     Software Engineering II

Lecture 4– Object Oriented Analysis part 2
                     Example
• We are asked to build a system for keeping track
  of the time our workers spend working on
  customer projects.
• We divide projects into activities, and the
  activities into tasks. A task is assigned to a
  worker, who could be a salaried worker or an
  hourly worker.
• Each task requires a certain skill, and resources
  have various skills at various level of expertise.



05 - OOA                                               2
                                    Steps
• Analyze the written requirements
     –     Extract nouns: make them classes
     –     Extract verbs: make them associations
     –     Draw the OOA UML class diagrams
     –     Determine attributes
     –     Draw object diagrams to clarify class diagrams
• Determine the system’s use cases
     – Identify Actors
     – Identify use case
     – Relate use cases
• Draw sequence diagrams
     – One per use case
     – Use to assign responsibilities to classes
• Add methods to OOA classes
05 - OOA                                                    3
                     Example
• We are asked to build a system for keeping track
  of the time our workers spend working on
  customer projects.
                                      Customer
            Worker   *                     1

                1
                                          contracts
           spends                          *
                                  *
                *
                                       Project
                                  *
             Time    *




05 - OOA                                              4
                           Example
• We divide projects into activities, and the
  activities into tasks. A task is assigned to a
  worker, who could be a salaried worker or an
  hourly worker.
                                spent on ◄
                                               Time
           Project

               1..*       Assignment
                                       1
           Activity                          Worker

               1..*
                      *
            Task            SalariedWorker            HourlyWorker
05 - OOA                                                      5
                     Example
• Each task requires a certain skill, and workers
  have various skills at various level of expertise.

           Worker                          Task
              *                              *



              has           Skill
                                    1..*
                     1..*             requires ◄


              SkillLevel


05 - OOA                                               6
                                    Steps
• Analyze the written requirements
     –     Extract nouns: make them classes
     –     Extract verbs: make them associations
     –     Draw the OOA UML class diagrams
     –     Determine attributes
     –     Draw object diagrams to clarify class diagrams
• Determine the system’s use cases
     – Identify Actors
     – Identify use case
     – Relate use cases
• Draw sequence diagrams
     – One per use case
     – Use to assign responsibilities to classes
• Add methods to OOA classes
05 - OOA                                                    7
                        Example
            Customer
   companyName
   primeContact                 contracts
                                              Project
   address
   phone
   fax

N.B.
   • Project has no attribute in Customer
       • association is enough
   • no database id for Customer shown
       • in an OOA, only include an id if visible to users
       • may include such things during database design or OOD
 05 - OOA                                                   8
                        Example
           Project
  name
  description              contracts ◄   Customer
  startDate: date


           Activity
  name
  description                              Task
  startDate: date
  estHours: int
  deliverable: string
05 - OOA                                            9
                     Example
          Activity
                                  Constraint: A task may only
                                  be assigned to a worker who
                                  has the required skill.
              Task
description            requires
                                             Skill
startDate: date
estHours: int

    assigned to

                       has
          Worker

   05 - OOA                                            10
                              Example
         SkillLevel                                      Skill
                                         has
level: int                                           name: string
rateMultiplier: real

          assigned to           Worker
 Task
                        name: string



        SalariedWorker                          HourlyWorker
 salary: real                              hourlyWage: real
 vacationDays: int

   05 - OOA                                                      11
                     Example
                        Time
              start: dateTime
              end: dateTime
              hours: real

                            spent on

                    Assignment




       Task          assigned to       Worker
05 - OOA                                        12
                                    Steps
• Analyze the written requirements
     –     Extract nouns: make them classes
     –     Extract verbs: make them associations
     –     Draw the OOA UML class diagrams
     –     Determine attributes
     –     Draw object diagrams to clarify class diagrams
• Determine the system’s use cases
     – Identify Actors
     – Identify use case
     – Relate use cases
• Draw sequence diagrams
     – One per use case
     – Use to assign responsibilities to classes
• Add methods to OOA classes
05 - OOA                                                    13
                       Object Diagrams

                               :Time
                     start: Jan.23, 2002, 8:00
                     end: Jan.23, 2002, 18:00
                     hours: 4.2


                                       :Assignment



:Task                                                  :Worker
description: “develop class diagrams”                name: “Matt”

   05 - OOA                                                    14
                                    Steps
• Analyze the written requirements
     –     Extract nouns: make them classes
     –     Extract verbs: make them associations
     –     Draw the OOA UML class diagrams
     –     Draw object diagrams to clarify class diagrams
     –     Determine attributes
• Determine the system’s use cases
     – Identify Actors
     – Identify use case
     – Relate use cases
• Draw sequence diagrams
     – One per use case
     – Use to assign responsibilities to classes
• Add methods to OOA classes
05 - OOA                                                    15
                        Use Cases
• Actors:
     – Represent users of a system
           • human users
           • other systems
• Use cases
     – Represent functionality or services
       provided by a system to its users


05 - OOA                                     16
                      Use Case Diagrams
                  Time & Resource Management System
                               (TRMS)


                         Manage
                        Resources
  resource
  manager                               Manage
                                        Projects      project
                                                      manager

                      Log Time
    worker

                                                      <<actor>>
                                    Administer
                                     System            Backup
                                                       System
  system
  administrator
05 - OOA                                                          17
                  Resource Manager Use Cases


                             Add
                             Skill



                            Remove   <<uses>>   Find
                             Skill              Skill
           resource
           manager
                            Update
                             Skill




05 - OOA                                                18
            More Resource Manager Use Cases
                             Add
                            Worker



                            Remove
                                       <<uses>>          Find
                            Worker                      Worker



                            Update
 resource                   Worker
 manager
                  <<extends>>

                       Assign Skill            Unassign Skill
                        to Worker              from Worker

                            <<uses>>
                                       Find
                                       Skill
05 - OOA                                                         19
                                    Steps
• Analyze the written requirements
     –     Extract nouns: make them classes
     –     Extract verbs: make them associations
     –     Draw the OOA UML class diagrams
     –     Draw object diagrams to clarify class diagrams
     –     Determine attributes
• Determine the system’s use cases
     – Identify Actors
     – Identify use case
     – Relate use cases
• Draw sequence diagrams
     – One per use case
     – Use to assign responsibilities to classes
• Add methods to OOA classes
05 - OOA                                                    20
     Sequence Diagram – Assign Skill to Worker Use Case


           resource       Res. Mgr. Win: UI        :Worker        :Skill         :SkillLevel
           manager

                 find worker
                                     find worker
                                     by name


                 find skill
                                       find skill by name




                 assign skill
                 to worker              [worker does not currently have skill]
                                        assign skill to worker


05 - OOA                                                                                 21
                                    Steps
• Analyze the written requirements
     –     Extract nouns: make them classes
     –     Extract verbs: make them associations
     –     Draw the OOA UML class diagrams
     –     Draw object diagrams to clarify class diagrams
     –     Determine attributes
• Determine the system’s use cases
     – Identify Actors
     – Identify use case
     – Relate use cases
• Draw sequence diagrams
     – One per use case
     – Use to assign responsibilities to classes
• Add methods to OOA classes
05 - OOA                                                    22
                          Add Methods
• Read sequence diagrams to identify necessary methods




                             Worker
           name: string
           + static Worker findWorker(String name);
           + static list of Workers getWorkers();




05 - OOA                                                 23
                           In Design
• Bring methods closer to implementation




                             Worker
           name: string
           + static Worker findWorker(String name);
           + static int getNWorkers();
           + static Worker getWorker(int);




05 - OOA                                              24
                           In Design
 • Bring methods closer to implementation

WorkList
Int getNumListElements();          ListModel
String getListElement(int n);      int getNumListElements();
                                   String getListElement(int n);


                      Worker
  name: string
  + static Worker findWorker(String name);

 05 - OOA                                                  25

								
To top