Object-Oriented Analysis and Design Use cases Finding classes Collaboration and Sequence diagrams Associations between classes.

Slides:



Advertisements
Similar presentations
From use cases to classes (in UML). A use case for writing use cases Use case: writing a use case Actors: analyst, client(s) Client identifies and write.
Advertisements

Information System Engineering
Chapter 6 Review Questions
Unified Modeling Language
Ch 12: Object-Oriented Analysis
Software Engineering COMP 201
Lecturer: Sebastian Coope Ashton Building, Room G.18 COMP 201 web-page: Lecture.
Lecture 8 – USE CASE ANALYSIS
Department of Informatics, UC Irvine SDCL Collaboration Laboratory Software Design and sdcl.ics.uci.edu 1 Informatics 43 Introduction to Software Engineering.
Systems Analysis and Design in a Changing World, Fourth Edition
Practical Object-Oriented Design with UML 2e Slide 1/1 ©The McGraw-Hill Companies, 2004 PRACTICAL OBJECT-ORIENTED DESIGN WITH UML 2e Chapter 5: Restaurant.
Essentials of class models. 2 A very simple class model In UML, a class is shown in a class diagram as a rectangle giving its name.
SwE 313 Case Study Registration System.
Essentials of interaction diagrams Lecture 23 & 24.
Use Cases & Requirements Analysis By: Mostafa Elbarbary.
Essentials of interaction diagrams Lecture Outline Collaborations Interaction on collaboration diagrams Sequence diagrams Messages from an object.
© 2005 Prentice Hall4-1 Stumpf and Teague Object-Oriented Systems Analysis and Design with UML.
IMS1805 Systems Analysis Topic 3: Doing Analysis (continued from previous weeks)
Lecture a: Additional UML Models: Package, Activity, Deployment Lecture b: Generalization, Aggregation and Additional Domain Model Notation Copyright W.
03/12/2001 © Bennett, McRobb and Farmer Use Case Diagrams Based on Chapter 6 of Bennett, McRobb and Farmer: Object Oriented Systems Analysis and.
Sharif University of Technology Session # 7.  Contents  Systems Analysis and Design  Planning the approach  Asking questions and collecting data 
1 ODB Design Handling Associations in ODL M. Akhtar Ali School of Informatics.
Unified Modeling Language
Business Modeling Domain Modeling Source: Use Case Driven Object Modeling with UML – A Practical Approach By Doug Rosenberg ISBN:
Object-Oriented Analysis and Design
The chapter will address the following questions:
The Project AH Computing. Functional Requirements  What the product must do!  Examples attractive welcome screen all options available as clickable.
Chapter 7: The Object-Oriented Approach to Requirements
Entity Relationship Model Chapter 6. Basic Elements of E-R Model Entity Object of the real world that stores data. Eg. Customer, State, Project, Supplier,
USE Case Model.
Use Case Analysis From soft systems methodology to understanding the system functionality.
OO Analysis and Design CMPS OOA/OOD Cursory explanation of OOP emphasizes ▫ Syntax  classes, inheritance, message passing, virtual, static Most.
Project Analysis Course ( ) Week 2 Activities.
UML REVIEW –PART1 1. Introduction What is UML visual modelling language UML is a language not a methodology? Q: why is this distinction important? UML.
Object-Oriented Design & Patterns Cay S
Systems Analysis and Design in a Changing World, Fifth Edition
Introduction to Sequence Diagrams
SOFTWARE DESIGN AND ARCHITECTURE LECTURE 25. Review Design Level Class Diagram Identifying classes/Operations/Attributes Associations – Simple associations.
Systems Analysis and Design in a Changing World, 3rd Edition
Practical Object-Oriented Design with UML 2e Slide 1/1 ©The McGraw-Hill Companies, 2004 PRACTICAL OBJECT-ORIENTED DESIGN WITH UML 2e Chapter 4: Restaurant.
Chapter 5 Models and UML Notation for The Object-Oriented Approach.
Object-Oriented Design Simple Program Design Third Edition A Step-by-Step Approach 11.
Department of Informatics, UC Irvine SDCL Collaboration Laboratory Software Design and sdcl.ics.uci.edu 1 Informatics 43 Introduction to Software Engineering.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 14 Slide 1 Object-oriented Design.
5 Systems Analysis and Design in a Changing World, Fifth Edition.
Object Oriented Software Development
Use Case Textual Analysis
Lecture 9-1 : Intro. to UML (Unified Modeling Language)
Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall Object-Oriented Systems Analysis and Design Using UML Systems Analysis and Design,
McGraw-Hill/Irwin© 2008 The McGraw-Hill Companies, All Rights Reserved Chapter 17 Object-Oriented Design and Modeling Using the UML.
Use Case Diagrams. Introduction In the previous Lecture, you saw a brief review of the nine UML diagrams. Now that you have the clear, you'll start to.
CSCI 383 Object-Oriented Programming & Design Lecture 7 Martin van Bommel.
Object Oriented Programming and Data Abstraction Earl Huff Rowan University.
High Level Design Use Case Textual Analysis SE-2030 Dr. Mark L. Hornick 1.
BTS430 Systems Analysis and Design using UML Design Class Diagrams (ref=chapter 16 of Applying UML and Patterns)
1 Kyung Hee University Interaction Diagrams Spring 2001.
HTBN Batches These slides are intended as a starting point for further discussion of how eTime might be extended to allow easier processing of HTBN data.
FILES AND EXCEPTIONS Topics Introduction to File Input and Output Using Loops to Process Files Processing Records Exceptions.
1 Use Cases Object-Oriented Modeling and Design with UML (Second Edition) Blaha & Rumbaugh Sections 7.1, 8.1.
Use Case Diagrams A Detailed Description. Use Case Diagrams Use case diagrams describe relationships between users and use cases A use case is a (usually.
Engineering Quality Software Week02 J.N.Kotuba1 SYST Engineering Quality Software.
Elaboration popo.
Chapter 4: Business Process and Functional Modeling, continued
Object-Oriented Analysis and Design
Use Case Model.
Week 10: Object Modeling (1)Use Case Model
Topics Introduction to File Input and Output
Week 12: Activity & Sequence Diagrams
Software Design Lecture : 15.
Topics Introduction to File Input and Output
Presentation transcript:

Object-Oriented Analysis and Design Use cases Finding classes Collaboration and Sequence diagrams Associations between classes

Object-oriented design so far we have learnt how to implement programs in Java Java syntax for programming fundamentals sequence selection iteration writing and calling methods arrays how to convert a UML class diagram to Java code how to write an application that uses more than one class

Object-oriented design today's lecture is about how decide what to implement what do we want the program to do? what classes are needed? how do they interact with each other? will introduce some more UML use case diagrams, collaboration and sequence diagrams

School Scenario an application is needed to kept track of the students enrolled in a school the application needs to store the name, program, level and enrolment date of each student each student should be issued with a unique student number when they enrol the system should keep track of the next available student number the system should be able to print a list of all students registered, showing all the information recorded about each student

School Scenario the system should be able to find an individual student's record, searching by name, and print it out only current students should be stored in the system they should be deleted when they withdraw or graduate if a student changes their program, their record should be updated at the end of each year, any student who has passed should progress to the next level

Requirements gathering where does the scenario come from? a brief from the manager who commissions the system interviews with prospective users analysis of the current system etc. etc. – as you've learned in other modules it may be ambiguous and may not be complete may have to go back for clarification hopefully this scenario is familiar we have been using it throughout this module!

What next? construct a Use Case Model this is a UML element that describes what the system does from the user's point of view first decide who the users are these are called actors in UML then examine the scenario to find verbs that describe what the system does each separate piece of functionality is called a use case actors and use cases can be shown compactly on a use case diagram

Use case diagram actor shown as a stick man in this case we will assume a school administrator is the only actor in this scenario each use case shown in ellipse with a line to the actor who triggers the use case a use case has a short name which describes what happens from the point of view of the actor doesn't include implementation or system details can provide more details in a use case description

Use case description Use case: Enrol student Actor: Administrator Purpose: to enrol a new student onto the school system Steps: 1. The administrator chooses the "Enrol student option" 2. The system prompts for the new student's name and program 3. The administrator enters the information 4. The system enrols the students and displays a confirmation message, or an error message if the school is full

Refining use cases after considering the use cases you may want to refine them further printing a student's record, deleting their details, and updating their program or level all involve finding the student's record first we could specify a "find student by name" use case all the above use cases include the "find student by name" use case similarly we could define a "print student details" use case that is included when printing all the student records printing a single student's record

Identifying classes next you will need to identify the major classes in the system there are several strategies make a list of the nouns in the scenario and use case descriptions these are possible classes some may be attributes of classes consider classes describing well-known categories physical objects, actors, organisations, specifications, rules and policies, interfaces

Possible classes application student(a physical object) school(organisation) name program level enrolment date student number list of students administrator(actor) user interface(most systems require one or more user interface classes)

Refining the classes applicationX this is the whole system Student  School  nameX a simple attribute of Student programX a simple attribute of Student levelX a simple attribute of Student enrolment date  an attribute of student, but could represent using a class (Day) student number X a simple attribute of Student list of studentsX  this is the same as School administratorX not necessary to keep any details about the administrator user interface  SchoolApp

Class diagram once the classes have been identified, you can draw a class diagram showing how they are associated indicate classes using name only show associations with lines associations can have multiplicity * any number 1 only one 0..* 0 or more 1..* 1 or more

Outline class diagram a SchoolApp is the interface for up to one School a School can contain zero to many Student objects each Student object contains one Day object representing the enrolment date

Refining the classes once you have identified classes, you need to decide on their attributes and methods we did this in week 3 to find attributes, pick out nouns or facts from the scenario if they are not classes themselves, these are potential attributes of classes decide on a name and type for each associations are implemented using attributes implement 1:1 association between Student and Day by having an attribute of type Day in Student implement 1:0..* association between School and Student by having an array of Students in School

Class diagram with attributes

Identifying methods pick out actions from the scenario these are potential methods which class do they belong to? one action may be carried out by a chain of methods in several associated classes can show on collaboration or sequence diagrams (next slides) decide on a name for each method do they need information? these are parameters – decide on type do they return a value? if so, what type?

Collaboration diagram for enrolling a student

Sequence diagram for enrolling a student

Sequence and collaboration diagrams way to show interactions between objects by calling each other's methods both diagrams show similar information collaboration diagram emphasises relationships between objects sequence diagrams emphasises time not covered in detail in this course but you may find them useful when designing large systems in future

One-way associations the associations shown in the School example are one-way Day does not have any attributes referring to the Student who enrolled on that date there is no need Day was written to be used in many different applications if Day had a reference to Student we could only use it in this application

Many-to-many associations many-to-many associations are allowed in object-oriented models this is unlike relational databases if we extended our scenario, we could allow each student to enrol on up to 6 modules each module would have a list of students signed up to it we can implement this using arrays

Many-to-many associations a Student can take up to 6 Modules a Module has many enrolled Students

BUT!!! often we want to store additional information about the many-to-many association in this example, we might want to store the date the student enrolled on the module and the module mark where could we store this information? not in Module a Module is taken by many Student s in Student ??? would need an array of mark s and enrolmentDate s corresponding to the array of Module s gets messy –what if we sorted the array of Module s? not object-oriented related information should be stored together

Association classes often we will need to create an association class to hold the information about a relationship in this case it would describe the relationship between Student and Module call it StudentModule Module could have an array of StudentModule objects representing the students enrolled on it Student could have an array of StudentModule objects representing the modules the student is taking StudentModule will need attributes of type Student and Module to represent the student and module it is linking mark and enrolment date attributes

Association classes

Using association classes use an association class whenever you need to store information about a relationship most often many-to-many relationship Student:Module marks, enrolmentDate Customer:Product quantity, orderDate could be more than two-way relationship Customer:Product:Order quantity just need one attribute for each class linked

Summary have (briefly) covered OO analysis and design from scenario to complete class diagram what does the system do? use cases how should it be constructed? classes, attributes, methods, associations new UML diagrams use case collaboration sequence how to implement associations using attributes situations where an association class is needed