Analysis

845 views
732 views

Published on

Published in: Technology, Business
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
845
On SlideShare
0
From Embeds
0
Number of Embeds
11
Actions
Shares
0
Downloads
39
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Analysis

  1. 1. Object Oriented Analysis & Design
  2. 2. Contents <ul><li>Why OOA/OOD </li></ul><ul><li>The Software life cycle </li></ul><ul><li>Detailed example </li></ul><ul><ul><li>following an example from “Patterns in Java” by Mark Grand </li></ul></ul>
  3. 3. Why OOA/OOD <ul><li>Claims to model the same way we think </li></ul><ul><ul><li>we think of something - a concept - and then wonder “what can it do ?” </li></ul></ul><ul><li>Easy transition from analysis/design to implementation... </li></ul><ul><ul><li>...using an object oriented language </li></ul></ul><ul><li>Claims to reduce risk </li></ul><ul><li>Trendy </li></ul><ul><ul><li>just look at want adds </li></ul></ul>
  4. 4. OOA/OOD Process <ul><li>Planing </li></ul><ul><ul><li>Business case </li></ul></ul><ul><ul><li>Budget </li></ul></ul><ul><li>Detailed Planing </li></ul><ul><ul><li>Requirement specification </li></ul></ul><ul><ul><li>Essential use-cases </li></ul></ul><ul><ul><li>Prototype </li></ul></ul><ul><li>Build </li></ul><ul><ul><li>Phase 1 </li></ul></ul><ul><ul><ul><li>OOA </li></ul></ul></ul><ul><ul><ul><ul><li>Low level essential use cases </li></ul></ul></ul></ul><ul><ul><ul><ul><li>Conceptual Model </li></ul></ul></ul></ul><ul><ul><ul><ul><li>Sequence diagrams </li></ul></ul></ul></ul>
  5. 5. OOA/OOD Process (cont’) <ul><li>Build </li></ul><ul><ul><li>Phase 2 </li></ul></ul><ul><ul><ul><li>UI design </li></ul></ul></ul><ul><ul><ul><li>DB design </li></ul></ul></ul><ul><ul><ul><li>OOD </li></ul></ul></ul><ul><ul><ul><ul><li>Class diagrams </li></ul></ul></ul></ul><ul><ul><ul><ul><li>Collaboration diagrams </li></ul></ul></ul></ul><ul><ul><ul><ul><li>State diagrams </li></ul></ul></ul></ul><ul><ul><li>Phase 3 </li></ul></ul><ul><ul><ul><li>Usability testing </li></ul></ul></ul><ul><ul><ul><li>Coding </li></ul></ul></ul><ul><ul><ul><li>Physical DB design </li></ul></ul></ul><ul><ul><li>Phase 4 </li></ul></ul><ul><ul><ul><li>Testing </li></ul></ul></ul>
  6. 6. OOA/OOD Process (cont’) <ul><li>Build </li></ul><ul><ul><li>Orthogonal activities </li></ul></ul><ul><ul><ul><li>Write documentation and Help </li></ul></ul></ul><ul><li>Deployment </li></ul>
  7. 7. Case study - Henry’s Food Market <ul><li>Henry’s Food Market operates five retail stores. To support these stores, it also </li></ul><ul><li>operates a warehouse and a commercial bakery that produces the baked goods that </li></ul><ul><li>the stores sell. Most of its employees are paid by the hour. Employee hours are tracked </li></ul><ul><li>by a time-clock system. When employees start work, go on breaks, return from breaks, </li></ul><ul><li>or leave work they are supposed to slide their employee badges through a timekeeping </li></ul><ul><li>clock that records their hours. </li></ul><ul><li>Henry’s Food Market wants to expand, increasing the number of its stores from 5 to 21 </li></ul><ul><li>over the next 2 years at a rate of 2 stores every 3 months. One of the challenges that </li></ul><ul><li>faces the company is that if it continues to use its existing timekeeping system, it will </li></ul><ul><li>have to hire more people to handle the administrative side of timekeeping. Currently, </li></ul><ul><li>each location requires a person working half-time as a timekeeper to administer its </li></ul><ul><li>timekeeping system. The activities the timekeeper is required to perform are as follows: </li></ul><ul><li>The timekeeper prints reports for supervisors that show the number of hours that each employee worked the previous day. This allows supervisors the ability to verify that their subordinates worked the stated number of hours. Some common errors that are uncovered by the supervisors who review these reports are: </li></ul><ul><ul><li>Employees don’t clock out when they go on break or leave work. </li></ul></ul><ul><ul><li>Coworkers clock in employees who are late to work. </li></ul></ul><ul><ul><li>Employees clock in before start of their shift. </li></ul></ul><ul><li>The timekeeper enters corrections into the timekeeping system. </li></ul><ul><li>The timekeeper prepares weekly reports that show the number of hours every employee in a location worked and sends those reports to the payroll department. </li></ul><ul><li>… (other cost-related topics - do Project Planing & Management - IE Department) </li></ul>
  8. 8. Define Requirement Specification <ul><li>Required Functions </li></ul><ul><ul><li>the things the system must do </li></ul></ul><ul><ul><ul><li>record the time an employee starts work </li></ul></ul></ul><ul><li>Required Attributes </li></ul><ul><ul><li>other characteristics of the system </li></ul></ul><ul><ul><ul><li>use of time-keeping terminals not require more than an eight-grade education </li></ul></ul></ul><ul><li>Assumptions </li></ul><ul><ul><li>list of things that are assumed to be true </li></ul></ul><ul><ul><ul><li>minimum education requirement for employees </li></ul></ul></ul><ul><ul><ul><li>the company won’t become unionized </li></ul></ul></ul><ul><li>Risks </li></ul><ul><ul><li>technical uncertainties. </li></ul></ul><ul><ul><ul><li>availability of terminals </li></ul></ul></ul><ul><ul><li>non-technical concerns. </li></ul></ul><ul><ul><ul><li>change in labor laws </li></ul></ul></ul><ul><li>Dependencies </li></ul><ul><ul><ul><li>the project relies on the existence of a WAN - wide area network </li></ul></ul></ul>
  9. 9. Requirement Matrix As we develop some use cases, you can expect to discover additional required functions
  10. 10. Requirements Matrix <ul><li>Organize the requirements onto categories (linnaean classification) </li></ul><ul><ul><li>allows trace and cross-reference of requirements </li></ul></ul><ul><li>Enable us to justify every capability we include/drop from our product </li></ul><ul><ul><li>again - cross reference </li></ul></ul><ul><li>Serves as a basis for System testing </li></ul><ul><ul><li>every item on the requirement matrix should be tested </li></ul></ul>
  11. 11. High Level Essential Use Cases A common use case:
  12. 12. High Level Essential Use Cases Course of Events: Tracking the course of even we can see another requirement we didn’t document yet: R1.3 The times displayed and recorded by different timekeeping terminals must be within 5 seconds of each other
  13. 13. Prototypes <ul><li>What </li></ul><ul><ul><li>A look and feel of the real thing </li></ul></ul><ul><ul><ul><li>assists in early discovery of conceptual errors </li></ul></ul></ul><ul><li>How </li></ul><ul><ul><li>Rapid Prototyping tools </li></ul></ul><ul><ul><ul><li>Visual Basic </li></ul></ul></ul><ul><ul><ul><li>SWIG </li></ul></ul></ul>
  14. 14. Object Oriented Analysis <ul><li>Our purpose: construct a conceptual model of the problem. </li></ul><ul><ul><li>Identify the entities that are involved. </li></ul></ul><ul><ul><li>identify the relationships between these entities. </li></ul></ul><ul><li>Heuristics </li></ul><ul><ul><li>Look for the nouns in the problem description. </li></ul></ul><ul><ul><li>Use CRC cards. </li></ul></ul>
  15. 15. Case study - Henry’s Food Market <ul><li>Henry’s Food Market operates five retail stores . To support these stores, it also </li></ul><ul><li>operates a warehouse and a commercial bakery that produces the baked goods that </li></ul><ul><li>the stores sell. Most of its employees are paid by the hour . Employee hours are tracked </li></ul><ul><li>by a time-clock system . When employees start work , go on breaks , return from breaks, </li></ul><ul><li>or leave work they are supposed to slide their employee badges through a timekeeping </li></ul><ul><li>clock that records their hours. </li></ul><ul><li>Henry’s Food Market wants to expand, increasing the number of its stores from 5 to 21 </li></ul><ul><li>over the next 2 years at a rate of 2 stores every 3 months. One of the challenges that </li></ul><ul><li>faces the company is that if it continues to use its existing timekeeping system , it will </li></ul><ul><li>have to hire more people to handle the administrative side of timekeeping. Currently, </li></ul><ul><li>each location requires a person working half-time as a timekeeper to administer its </li></ul><ul><li>timekeeping system. The activities the timekeeper is required to perform are as follows: </li></ul><ul><li>The timekeeper prints reports for supervisors that show the number of hours that each employee worked the previous day . This allows supervisors the ability to verify that their subordinates worked the stated number of hours. Some common errors that are uncovered by the supervisors who review these reports are: </li></ul><ul><ul><li>Employees don’t clock out when they go on break or leave work. </li></ul></ul><ul><ul><li>Coworkers clock in employees who are late to work. </li></ul></ul><ul><ul><li>Employees clock in before start of their shift . </li></ul></ul><ul><li>The timekeeper enters corrections into the timekeeping system. </li></ul><ul><li>The timekeeper prepares weekly reports that show the number of hours every employee in a location worked and sends those reports to the payroll department . </li></ul><ul><li>… (other cost-related topics - do Project Planing & Management - IE Department) </li></ul>
  16. 16. A Conceptual Model PayPeriod Timekeeper Employee Break Supervisor Timekeeping Event Shift EmployeeBadge TimekeepingLog TimekeepingSystem EmployeeID TimekeepingReport PayrollSystem
  17. 17. A Conceptual Model - with associations PayPeriod Timekeeper Employee Break Supervisor Timekeeping Event Shift EmployeeBadge TimekeepingLog TimekeepingSystem EmployeeID TimekeepingReport PayrollSystem Is-A Uses Modifies Creates Is-part-of Is-A Owns Modifies Belongs-to Uses Is-part-of Is-part-of Contains possession owner user usee creator createe part whole part whole part whole user usee 1 1 1 0..* 0..* 0..* 1 1 1 0..* 0..* 1 1 1 0..1 2
  18. 18. A Conceptual Model - with attributes TimekeepingEvent PayPeriod Timekeeper Employee Break Supervisor Shift EmployeeBadge TimekeepingLog TimekeepingSystem employeeID TimekeepingReport PayrollSystem Is-A Uses Modifies Creates Is-part-of Is-A Owns Modifies Belongs-to Uses Is-part-of Is-part-of Contains possession owner user usee creator createe part whole part whole part whole user usee 1 1 1 0..* 0..* 0..* 1 1 1 0..* 0..* 1 1 1 0..1 2 when:time start:time end:time
  19. 19. CRC Cards <ul><li>Class-Responsibility-Collaboration cards </li></ul><ul><li>3x5 or 4x6 cards </li></ul>Class name (* if abstract) <ul><li>List of responsibilities </li></ul><ul><li>... </li></ul><ul><li>List of collaborating classes </li></ul><ul><li>... </li></ul>
  20. 20. Object Oriented Design <ul><li>Construct Class diagrams </li></ul><ul><li>Define All use cases </li></ul><ul><li>Create interaction diagrams based on use cases </li></ul><ul><ul><li>Collaboration Diagrams </li></ul></ul><ul><ul><li>Sequence Diagrams </li></ul></ul><ul><li>Define system behavior as a state machine </li></ul><ul><ul><li>State Diagrams </li></ul></ul>
  21. 21. Class Diagrams <ul><li>Incremental process - add classes on the fly. </li></ul><ul><li>Start modeling program domain classes and not just problem domain classes e.g. </li></ul><ul><ul><li>User Interface </li></ul></ul><ul><ul><li>Transaction Log </li></ul></ul><ul><ul><li>Containers </li></ul></ul><ul><li>The conceptual model is an excellent start. </li></ul>
  22. 22. Class Diagram - Ver. 1 <ul><li>Add acessor methods for all attributes </li></ul>TimekeepingEvent PayPeriod Timekeeper Employee Break Supervisor Shift EmployeeBadge TimekeepingLog TimekeepingSystem getEmployeeID:String TimekeepingReport PayrollSystem getTime():Date getStart():Date getEnd():Date
  23. 23. Class Diagram - Ver. 2 <ul><li>Consider “Is-A” relationships </li></ul>TimekeepingEvent PayPeriod Timekeeper Employee Break Supervisor Shift EmployeeBadge TimekeepingLog TimekeepingSystem getEmployeeID:String TimekeepingReport PayrollSystem getTime():Date getStart():Date getEnd():Date Why would we prefer delegation rather than inheritance for these classes ?
  24. 24. Detailed Use Cases A common use case:
  25. 25. High Level Essential Use Cases Course of Events: This use case involves classes that are not in the previous class diagram - a timekeeping terminal’s user-interface, which in turn be further broken down to other classes.
  26. 26. Collaboration Diagram <ul><li>Start shift collaboration diagram </li></ul>:UserInterface :TimekeepingControler :TimekeepingEvent :Database 1: doTransaction(id) 1.2: eventType := getEventType() 1.1: emp := lookupEmployee() 1.4: storeEvent(start) 1.3:start = createEvent(eventType) id:EmployeeID emp:Employee start:StartShiftEvent
  27. 27. Class Diagram - Ver. 3 TimekeepingEvent START_SHIFT:int = 0 {frozen} START_BREAK:int = 1 {frozen} END_SHIFT:int = 2 {frozen} END_BREAK:int = 3 {frozen} getEmployee():Employee getTime():Date createEvent(eventType:int):TimekeepingEvent Timekeeper Supervisor PayPeriod getStart():Date getEnd():Date Break Shift TimekeepingLog TimekeepingReport PayrollSystem Uses-symbolic-names-defined-by Uses Request- event-object-creation Stores-and-fetches-data-for Plays-role Plays-role role role player player 1 1 1 1 1 1 1 1 1 0 1 0 requestor creator UserInterface getEventType():int TimekeepingController doTransaction(employeeID:String) Database lookupEmployee(employeeID:String):Employee storeEvent(event:TimekeepingEvent) Employee getEmployeeID():String
  28. 28. State Diagrams <ul><li>Based on David Harel’s Statecharts. </li></ul><ul><li>A state machine describing some process. </li></ul><ul><li>State Diagrams are comprised of: </li></ul><ul><ul><li>states </li></ul></ul><ul><ul><ul><li>modeling a certain state an object might be in. </li></ul></ul></ul><ul><ul><li>transitions </li></ul></ul><ul><ul><ul><li>describing how object state may change </li></ul></ul></ul><ul><ul><li>actions </li></ul></ul><ul><ul><ul><li>which are performed in a state </li></ul></ul></ul><ul><ul><li>triggers </li></ul></ul><ul><ul><ul><li>which activate state transitions (may be guarded by a predicate) </li></ul></ul></ul>
  29. 29. State Diagrams (cont’) StartPayPeriod StartPayPeriod Enter / incompleteShift=false startTime=event.getTime() StartBreak Enter / breakTime=event.getTime() EndBreak Enter / unpaidHours += event.getTime()- breakTime regularHours -= eventTime()-breakTime EndShift Enter / regularHours += event.getTime()-startTime if (regularHours>40) { overtimeHours += regularHours - 40; regularHours = 40; } regularPay = regularHours * payRate; overtimePay = overtimeHours * payRate * 1.5; createShift(); regularHours=0; overtimeHours=0; unpaidHours=0; regularPay=0; overtimePay=0; StartShift StartBreak EndBreak StartBreak EndShift StartShift EndShift

×