1Introduction Course Overview Lecture 1 Wednesday July 25, 2007 COMP5028 Object-Oriented Analysis and Design (S2 2007) © Dr. Ying Zhou, School of IT, The University of Sydney 2 Agenda Administrative Course objective and outline Course Glossary OOAD UML Methodology: Iterative Development Pattern COMP5028 Object-Oriented Analysis and Design (S2 2007) © Dr. Ying Zhou, School of IT, The University of Sydney 3 Administrative Instructor Dr. Ying ZHOU (zhouy@it.usyd.edu.au) Office: SIT 437 Lectures Wednesday 6-8 pm SIT Lecture Theatre Labs Wednesday 8-9 SIT 116/117 (start from week 2) Course Website: http://www.cs.usyd.edu.au/~comp5028/s2_2007 COMP5028 Object-Oriented Analysis and Design (S2 2007) © Dr. Ying Zhou, School of IT, The University of Sydney 4 Communication Channels Consultation Monday 3-4 pm, SIT 437 Email: zhouy@it.usyd.edu.au WebCT discussion board All news, notices will be published there COMP5028 Object-Oriented Analysis and Design (S2 2007) © Dr. Ying Zhou, School of IT, The University of Sydney 5 Objectives Learn O-O A&D methodology Learn UML (Unified Modeling Language) Learn O-O design patterns/principles Build something that illustrates the concepts And the ultimate goal is… To write good software COMP5028 Object-Oriented Analysis and Design (S2 2007) © Dr. Ying Zhou, School of IT, The University of Sydney 6 Enrolment advise Who should take this course? Do you know Java/C#? Do you have enthusiasm in software development? Can you appreciate beautiful structure? Who should probably back away from this course? Are you completely new to Java/C#? Are you looking for a course to get easy mark? Do you hate coding? COMP5028 Object-Oriented Analysis and Design (S2 2007) © Dr. Ying Zhou, School of IT, The University of Sydney 7 Expectations Assumed Knowledge Java or other similar OO language (C#) Java is the official language in this course BEFORE each lecture Download and printout the lecture slides Read the related chapter(s) and lectures notes Read the tutorial instruction Make sure you keep up with the progress Consult course staff EARLY enough for difficulties and problems! COMP5028 Object-Oriented Analysis and Design (S2 2007) © Dr. Ying Zhou, School of IT, The University of Sydney 8 Course Outline Two Major parts of the content OOA (3 weeks) Use Case Model, Domain Modeling OOD (11 weeks) Design principles and patterns COMP5028 Object-Oriented Analysis and Design (S2 2007) © Dr. Ying Zhou, School of IT, The University of Sydney 9 Assessment Components One Hour Quiz (open book) (20%) Held in Week 5’s tutorial hour Result back in week 8 Assignment (20%) Due in Week 12 Result back in week 13 Results will be published on webCT two weeks after the due date, please check WebCT to make sure that your results are correctly recorded. Any discrepancies should be resolved within one week after the result being published! Final Exam (60%) Closed book, 2 hours Sample exam will be given Should expect question regarding coding COMP5028 Object-Oriented Analysis and Design (S2 2007) © Dr. Ying Zhou, School of IT, The University of Sydney 10 Our Textbook Craig Larman, Applying UML and Patterns: An Introduction to Object-Oriented Analysis and Design and Iterative Development, 3rd edition, Prentice Hall PTR, 2005 Detailed Intro to Object- Oriented Analysis & Design Unified Modeling Language (UML) Design Patterns COMP5028 Object-Oriented Analysis and Design (S2 2007) © Dr. Ying Zhou, School of IT, The University of Sydney 11 Reference Books Martin Fowler, UML Distilled, 3rd edition, Addison- Wesley, 2004 Robert C. Martin, Agile Software Development: Principles, Patterns and Practices, Prentice Hall, 2003 Erich Gamma, Richard Helm, Ralph Johnson, John Vlissides, Design Patterns, Addison-Wesley, 1995 Allan Shalloway ,James R. Trott Design patterns explained: A new perspective on Object-Oriented Design, 2nd edition, Addison-Wesley, 2005. Eric Freeman, Elisabeth Freeman, Kathy Sierra and Bert Bates, Head First Design Patterns, O'Reilly, 2004 COMP5028 Object-Oriented Analysis and Design (S2 2007) © Dr. Ying Zhou, School of IT, The University of Sydney 12 Software Microsoft Visio Licensed software Installed on the lab PCs Used for drawing diagrams J2SE 1.5 or above Free download from java.sun.com Used for running sample code or assignments COMP5028 Object-Oriented Analysis and Design (S2 2007) © Dr. Ying Zhou, School of IT, The University of Sydney 13 Rule of Conducts Okay to discuss ideas and problem approaches All work must be your own creation Plagiarism will not be tolerated under any circumstance! What is plagiarism Copying all or part of another student’s work (with or without their knowledge) Using another person’s ideas without acknowledgement Obtaining material (code or other) from the web or a book and passing it off as your own 14 Questions? COMP5028 Object-Oriented Analysis and Design (S2 2007) © Dr. Ying Zhou, School of IT, The University of Sydney 15 What is good software? End Users: Managers: Developers: COMP5028 Object-Oriented Analysis and Design (S2 2007) © Dr. Ying Zhou, School of IT, The University of Sydney 16 Today’s lecture topic What is OOAD? Basic OOAD methodology: Iterative Development What is UML? What is PATTERN COMP5028 Object-Oriented Analysis and Design (S2 2007) © Dr. Ying Zhou, School of IT, The University of Sydney 17 What is Analysis and Design Analysis emphasizes an investigation of the problem rather than how a solution is defined Design emphasizes a logical solution, how the system fulfills the requirements COMP5028 Object-Oriented Analysis and Design (S2 2007) © Dr. Ying Zhou, School of IT, The University of Sydney 18 Analysis and Design (cont) Division between A & D is fuzzy A & D activities exist on a continuum Some practitioners can classify an activity as analysis while others put it into design category More analysis oriented More design oriented -what -requirements -investigation of domain -understanding of problem -how -logical solution -understanding and description of solution COMP5028 Object-Oriented Analysis and Design (S2 2007) © Dr. Ying Zhou, School of IT, The University of Sydney 19 What is O-O A&D? The essence of O-O A&D is to consider a problem domain and logical solution from the perspective of objects (things, concepts, or entities) O-O Analysis emphasizes finding and describing the objects – or concepts- in the problem domain O-O Design emphasizes defining logical software objects (things, concepts, or entities) that have attributes and methods COMP5028 Object-Oriented Analysis and Design (S2 2007) © Dr. Ying Zhou, School of IT, The University of Sydney 20 Object vs. Function Oriented Analysis Library Info System O-O A&D Decompose by objects and concepts Structured A&D Decompose by functions and processes Catalog Librarian Book Library System Record Loans Add Resource Report Fines COMP5028 Object-Oriented Analysis and Design (S2 2007) © Dr. Ying Zhou, School of IT, The University of Sydney 21 Object vs. Function Oriented Analysis Object has good encapsulation Every object has a public interface and private implementation Easy to modify the detailed implementation Easy to plug in / switch component COMP5028 Object-Oriented Analysis and Design (S2 2007) © Dr. Ying Zhou, School of IT, The University of Sydney 22 Unified Modeling Language “A language for specifying, visualizing and constructing the artifacts of software system” [Booch, Jacobson, Rumbaugh] It is a notational system aimed at modeling systems using O-O concepts Define " boxes", "lines " with specific meanings COMP5028 Object-Oriented Analysis and Design (S2 2007) © Dr. Ying Zhou, School of IT, The University of Sydney 23 UML diagrams Use case diagram Class diagram Behavior diagrams: statechart diagram activity diagram interaction diagrams: Sequence diagram Collaboration diagram Implementation diagrams: component diagram deployment diagram COMP5028 Object-Oriented Analysis and Design (S2 2007) © Dr. Ying Zhou, School of IT, The University of Sydney 24 What is legal UML? Legal UML is what is defined as well formed in the specification Prescriptive rules A language with prescriptive rules is controlled by an official body that states what is or isn’t legal in the language and what meaning you give to utterances in that language Descriptive rules A language with descriptive rules is one which you understand its rules by looking at how people use the language in practice COMP5028 Object-Oriented Analysis and Design (S2 2007) © Dr. Ying Zhou, School of IT, The University of Sydney 25 OOA/D Methodology What does methodology mean? Basic steps An overall plan of organizing those steps Rationale and philosophy COMP5028 Object-Oriented Analysis and Design (S2 2007) © Dr. Ying Zhou, School of IT, The University of Sydney 26 Key Steps in OOAD [1] Use Case: a textual description or “story” describing the system Example: Play A Dice Game: “A player picks up and rolls the dice. If the dice face values total seven, they win; otherwise, they lose.” Define domain model Define interaction diagrams Define design class diagramsDefine use cases COMP5028 Object-Oriented Analysis and Design (S2 2007) © Dr. Ying Zhou, School of IT, The University of Sydney 27 Key steps in OOAD [2] Domain Model: diagram(s) showing domain concepts, attributes, and associations Example: Player name DiceGame Die faceValue Rolls Plays Includes 2 2 1 1 1 1 Define domain model Define interaction diagrams Define design class diagramsDefine use cases COMP5028 Object-Oriented Analysis and Design (S2 2007) © Dr. Ying Zhou, School of IT, The University of Sydney 28 Key steps in OOAD [3] Interaction Diagram: shows the flow of messages between software objects (method invocation) Define domain model Define interaction diagrams Define design class diagramsDefine use cases :DiceGame play() die1 : Die fv1 := getFaceValue() die2 : Die roll() roll() fv2 := getFaceValue() Example: COMP5028 Object-Oriented Analysis and Design (S2 2007) © Dr. Ying Zhou, School of IT, The University of Sydney 29 Key steps in OOAD [4] Define domain model Define interaction diagrams Define design class diagramsDefine use cases Class Model: shows attributes, methods and associations for software (solution) objects (not domain objects!) 2 Die faceValue : int getFaceValue() : int roll() DiceGame die1 : Die die2 : Die play() 1 Example: COMP5028 Object-Oriented Analysis and Design (S2 2007) © Dr. Ying Zhou, School of IT, The University of Sydney 30 Iterative and Evolutionary Development Iterative development Development is organized into a series of short, fixed-length mini-projects called iterations. The outcome of each is a tested, integrated, and executable partial system. Known as iterative and incremental development COMP5028 Object-Oriented Analysis and Design (S2 2007) © Dr. Ying Zhou, School of IT, The University of Sydney 31 Iterative and evolutionary development Requirements Design Implementation & Test & Integration & More Design Final Integration & System Test Requirements Design 4 weeks (for example) The system grows incrementally. Feedback from iteration N leads to refinement and adaptation of the requirements and design in iteration N+1. Iterations are fixed in length, or timeboxed. Time Implementation & Test & Integration & More Design Final Integration & System Test COMP5028 Object-Oriented Analysis and Design (S2 2007) © Dr. Ying Zhou, School of IT, The University of Sydney 32 Handle change on iterative project Early iterations are farther from the "true path" of the system. Via feedback and adaptation, the system converges towards the most appropriate requirements and design. In late iterations, a significant change in requirements is rare, but can occur. Such late changes may give an organization a competitive business advantage. one iteration of design, implement, integrate, and test COMP5028 Object-Oriented Analysis and Design (S2 2007) © Dr. Ying Zhou, School of IT, The University of Sydney 33 How long should an iteration be? Most iterative methods recommend an iteration length between two and six weeks. Iteration are timeboxed, or fixed in length Date slippage is illegal If it seems difficult to meet the deadline, the recommended response is to de-scope – remove tasks or requirements from the iteration, and include them in a future iteration COMP5028 Object-Oriented Analysis and Design (S2 2007) © Dr. Ying Zhou, School of IT, The University of Sydney 34 The oldest waterfall lifecycle Attempt to define all or most of the requirements before programming. To create a thorough design before programming Strongly associated with high rates of failure, lower productivity, and higher defect rates. 45% of the features in waterfall requirements are never used, early waterfall schedules and estimates vary up to 400% from the final actuals. COMP5028 Object-Oriented Analysis and Design (S2 2007) © Dr. Ying Zhou, School of IT, The University of Sydney 35 Mini workshop Which one of the following is true iterative development I’ve done five iterations on requirement collection and the client finally satisfied and signed off the requirement document. We take iterative method to achieve good database design. After the first interview with the client, we make an initial design of the database and brought this to the client. We got valuable feedback from them and made according changes, we repeat this process for four times and now have our final version of the database design COMP5028 Object-Oriented Analysis and Design (S2 2007) © Dr. Ying Zhou, School of IT, The University of Sydney 36 How to do iterative and evolutionary analysis and design COMP5028 Object-Oriented Analysis and Design (S2 2007) © Dr. Ying Zhou, School of IT, The University of Sydney 37 Unified Process (UP) -- Methodology COMP5028 Object-Oriented Analysis and Design (S2 2007) © Dr. Ying Zhou, School of IT, The University of Sydney 38 UP Phases Inception – Approximate vision, business case, scope, vague estimates Elaboration – refined vision, iterative implementation of the core architecture, resolution of high risks, identification of most requirements and scope, more realistic estimates Construction – iterative implementation of the remaining lower risk and easier elements, and preparation for deployment Transition – beta tests, deployment COMP5028 Object-Oriented Analysis and Design (S2 2007) © Dr. Ying Zhou, School of IT, The University of Sydney 39 Patterns Solution path to recurring problems in software development project Design patterns Analysis patterns COMP5028 Object-Oriented Analysis and Design (S2 2007) © Dr. Ying Zhou, School of IT, The University of Sydney 40 An overall picture A development task A blue print of steps to achieve the task (methodology, example: UP) A few tricks or shortcuts in each step (principles and patterns) An efficient way to communicate the job/result of each step (UML diagram) COMP5028 Object-Oriented Analysis and Design (S2 2007) © Dr. Ying Zhou, School of IT, The University of Sydney 41 Layers and texbook case study User Interface Sale Payment Logging ... Database Access ... application logic layer other layers or components minor focus explore how to connect to other layers primary focus of case studies explore how to design objects secondary focus COMP5028 Object-Oriented Analysis and Design (S2 2007) © Dr. Ying Zhou, School of IT, The University of Sydney 42 Cases Case one: The NextGen POS system A POS system is a computerized application used (in part) to record sales and handle payments Hardware: computer, bar code scanner Software Interfaces to service applications: tax calculator, inventory control Case Two: The Monopoly Game System