OO System Models Static Views

Similar documents
Introducing the UML Eng. Mohammed T. Abo Alroos

System models Abstract descriptions of systems whose requirements are being analysed. System modelling. Structured methods

Ch t 8 Chapter 8. System Models

Object Oriented Analysis & Design (OOAD)

8.0. Classes and Classification In the real world

S T R U C T U R A L M O D E L I N G ( M O D E L I N G A S Y S T E M ' S L O G I C A L S T R U C T U R E U S I N G C L A S S E S A N D C L A S S D I A

Chapter 5: Structural Modeling

Class diagrams. Modeling with UML Chapter 2, part 2. Class Diagrams: details. Class diagram for a simple watch

Software Engineering

Object Oriented Software Development CIS Today: Object Oriented Analysis

SOFTWARE ENGINEERING Prof.N.L.Sarda Computer Science & Engineering IIT Bombay. Lecture #10 Process Modelling DFD, Function Decomp (Part 2)

Enhanced Entity- Relationship Models (EER)

Conceptual Data Models for Database Design

Class Diagram Example Document's body has sentences. Sentences are made up of words and punctual signs. Words consists of letters, numbers and/or spec

Credit where Credit is Due. Lecture 4: Fundamentals of Object Technology. Goals for this Lecture. Real-World Objects

Object-Oriented Systems Analysis and Design Using UML

Chapter 10. Object-Oriented Analysis and Modeling Using the UML. McGraw-Hill/Irwin

OO Techniques & UML Class Diagrams

Chapter 2: Entity-Relationship Model

Modelling with Classes. CITS1220 Software Engineering

Exam Duration: 2hrs and 30min Software Design


Chapter 2 ENTITY RELATIONSHIP MODEL

Accessibility. EEC 521: Software Engineering. Classes and Objects. Inheritance. Classes and Objects (OO Analysis)

CSE 403: Software Engineering, Spring courses.cs.washington.edu/courses/cse403/15sp/ UML Class Diagrams. Emina Torlak

Class Diagram. Classes consist of. Note that class diagrams contain only classes, not objects.

Object-Oriented Software Engineering Practical Software Development using UML and Java

Lesson 06. Requirement Engineering Processes

Class Diagram. Classes consist of. Note that class diagrams contain only classes, not objects.

Topics. Overview- The UML Functional Model. Structural Model. Behavioral Models. Use Case Diagram (essential and system)

4. Entity Relationship Model

Design and UML Class Diagrams

Intro to DB CHAPTER 6

Relationships. Association Aggregation/Composition Multiplicity Dependencies

UML Class Diagrams Revisited

Database Systems. A Practical Approach to Design, Implementation, and Management. Database Systems. Thomas Connolly Carolyn Begg

Object Oriented Design. Program Design. Analysis Phase. Part 2. Analysis Design Implementation. Functional Specification

E-R Model. Hi! Here in this lecture we are going to discuss about the E-R Model.

LABORATORY 1 REVISION

COMP Instructor: Dimitris Papadias WWW page:

Entity-Relationship Modelling. Entities Attributes Relationships Mapping Cardinality Keys Reduction of an E-R Diagram to Tables

Unified Modeling Language (UML)

The Essence of Object Oriented Programming with Java and UML. Chapter 2. The Essence of Objects. What Is an Object-Oriented System?

Weak Entity Sets. A weak entity is an entity that cannot exist in a database unless another type of entity also exists in that database.

Unified Modeling Language (UML) and Modeling

CSIT5300: Advanced Database Systems

Design Engineering. Dr. Marouane Kessentini Department of Computer Science

SE 1: Software Requirements Specification and Analysis

MSO Analysis & UML. Hans Philippi (based on the course slides of Wouter Swierstra) August 24, Analysis & UML 1 / 56

Computer Science for Engineers

UML diagrams. Software artifacts include: SRS, SDS, test cases, source code, technical/user manual, software architecture, etc.

CSE 403 Lecture 8. UML Class Diagrams. Thanks to Marty Stepp, Michael Ernst, and other past instructors of CSE 403

MechEng SE3 Lecture 7 Domain Modelling

The Next Step: Designing DB Schema. Chapter 6: Entity-Relationship Model. The E-R Model. Identifying Entities and their Attributes.

Chapter 6: Entity-Relationship Model

CS 4604: Introduction to Database Management Systems. B. Aditya Prakash Lecture #5: Entity/Relational Models---Part 1

Introduction To UML PART II State Diagrams

The Unified Modeling Language. Asst.Prof.Dr. Supakit Nootyaskool IT-KMITL

Slide 1 Welcome to Fundamentals of Health Workflow Process Analysis and Redesign: Process Mapping: Entity-Relationship Diagrams. This is Lecture e.

Module 2 : Entity-Relationship Model 15

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION (Autonomous) (ISO/IEC Certified)

Class Diagrams in Analysis

Unified Modeling Language (UML) Class Diagram

Lecture3: Data Modeling Using the Entity-Relationship Model.

Inheritance. Inheritance Reserved word protected Reserved word super Overriding methods Class Hierarchies Reading for this lecture: L&L

Course on Database Design Carlo Batini University of Milano Bicocca

Chapter 6: Entity-Relationship Model. The Next Step: Designing DB Schema. Identifying Entities and their Attributes. The E-R Model.

Inheritance (Outsource: )

Class diagrams. Modeling with UML Chapter 2, part 2. Class Diagrams: details. Class diagram for a simple watch

Entity Relationship Data Model. Slides by: Shree Jaswal

Database Systems. Overview - important points. Lecture 5. Some introductory information ERD diagrams Normalization Other stuff 08/03/2015

UML Tutorial. Unified Modeling Language UML Tutorial

Chapter (4) Enhanced Entity-Relationship and Object Modeling

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION (Autonomous) (ISO/IEC Certified) MODEL ANSWER

Conceptual Database Design. COSC 304 Introduction to Database Systems. Entity-Relationship Modeling. Entity-Relationship Modeling

Experiment no 4 Study of Class Diagram in Rational Rose

Chapter No. 2 Class modeling CO:-Sketch Class,object models using fundamental relationships Contents 2.1 Object and Class Concepts (12M) Objects,

Information Systems Analysis and Design John Mylopoulos. Information Systems Analysis and Design CSC340. Class Diagrams -- 3

Fundamentals of Health Workflow Process Analysis and Redesign

Practical UML - A Hands-On Introduction for Developers

A - 1. CS 494 Object-Oriented Analysis & Design. UML Class Models. Overview. Class Model Perspectives (cont d) Developing Class Models

LECTURE 3: ENTITY-RELATIONSHIP MODELING

Lecture 5 STRUCTURED ANALYSIS. PB007 So(ware Engineering I Faculty of Informa:cs, Masaryk University Fall Bühnová, Sochor, Ráček

Object-Oriented Concepts and Principles (Adapted from Dr. Osman Balci)

Object Fundamentals Part Two. Kenneth M. Anderson University of Colorado, Boulder CSCI 4448/5448 Lecture 3 09/01/2009

Association, Aggregation and Composition. Software Engineering CITS1220

Software Design Models, Tools & Processes. Lecture 3: Addendum Cecilia Mascolo

COSC 3351 Software Design. An Introduction to UML (I)

Chapter 6: Entity-Relationship Model

Use of UML in Tranmodel

Inheritance and Interfaces

Unit 2 - Data Modeling. Pratian Technologies (India) Pvt. Ltd.

Practical UML : A Hands-On Introduction for Developers

Object-Oriented Software Engineering Practical Software Development using UML and Java. Chapter 5: Modelling with Classes

Conceptual Data Modeling and the Entity- Relationship Model. Department of Computer Science Northern Illinois University September 2014

Object-Oriented Systems Development: Using the Unified Modeling Language

IS 263 Database Concepts

Inheritance and Polymorphism

Lesson 11. W.C.Udwela Department of Mathematics & Computer Science

Conceptual Data Modeling Using E-R Models. PM Jat

Transcription:

OO System Models Static Views UML Class & Object Diagrams Software Engineering OO Models Class Diagram Slide 1

Objective Introduces the evolutionary approach for building classes Explain how to identify objects and attributes of classes Describe the technique of CRC Class Responsibility and Collaborator Explain how classes are related in a class diagram Explain generalization, association, aggregation and composition Introduce object diagrams Software Engineering OO Models Class Diagram Slide 2

OO Structural Modelling The Static View of a system may be described using UML diagrams: UML Class Diagrams Object Diagrams Software Engineering OO Models Class Diagram Slide 3

From Use Cases to: Objects, Attributes, Operations (methods) - evolutionary Class 1 Class 1 Class 1 Class 2 Class 2 Class 2 Software Engineering OO Models Class Diagram Slide 4

Identifying objects Look for nouns in the SRS (System Requirements Specifications) document Look for NOUNS in use cases descriptions A NOUN may be Object Attribute of an object Software Engineering OO Models Class Diagram Slide 5

Identifying Operations methods Look for verbs in the SRS (System Requirements Specifications) document Look for VERBS in use cases descriptions A VERB may be translated to an operation or set of operations A method is the code implementation of an operation. Software Engineering OO Models Class Diagram Slide 6

Objects Software Engineering OO Models Class Diagram Slide 7

Objects An object is a thing: student; transaction; car; customer account; employee; complex number; spreadsheet table; spreadsheet cell; document; paragraph; GUI Combo box GUI button... and so on. Software Engineering OO Models Class Diagram Slide 8

Class and Class diagram Class naming: Use singular names because each class represents a generalized version of a singular object. Class diagrams are at the core of OO Eng. Software Engineering OO Models Class Diagram Slide 9

Class and Class diagram Things naturally fall into categories (computers, automobiles, trees...). We refer to these categories as classes. An object class is an abstraction over a set of objects with common: attributes (states) and the services (operations) (methods) provided by each object Class diagrams provide the representations used by the developers. Software Engineering OO Models Class Diagram Slide 10

CRC Class Responsibility and Collaborator CRC card Class Responsibility: What the class knows: attributes What the class does: services (operations / methods) Software Engineering OO Models Class Diagram Slide 11

CRC Class Responsibility and Collaborator Class Collaboration: Request for information from another class (what the other class knows as attributes) Request another class to do some thing (what the other class does as operation) Software Engineering OO Models Class Diagram Slide 12

CRC Card What the class knows Or does Class name Responsibility CRC Card Collaboration Other classes needed to fulfill class a responsibility Need for Attribute operation Software Engineering OO Models Class Diagram Slide 13

CRC - Class Responsibility What the class knows Student Responsibility ID Name Department Address CRC Card Collaborator What the class does Request Register course Drop course Request Schedule Software Engineering OO Models Class Diagram Slide 14

CRC - Class Collaborator Sometimes a class A has a responsibility to fulfill, but not have enough information to do it. So class A needs help from another class See next example Software Engineering OO Models Class Diagram Slide 15

CRC - Class Collaborator For example, as you see in students register in courses. To do this, a student needs to know if a spot is available in the course and, if so, he then needs to be added to the course. However, students only have information about themselves (their names and so forth), and not about courses. What the student needs to do is collaborate/interact with the card labeled Course to sign up for a course. Therefore, Course is included in the list of collaborators of Student. Software Engineering OO Models Class Diagram Slide 16

CRC - Class Collaborator Student Responsibility ID Name Department Address Check course availability Request Register course Drop course Request Schedule Collaborator Course (Attribute: availability) Course (Operation: increment number of registered student) Course (Operation: decrement number of registered student) ----- Collaborator Course: Class Course is needed to fulfill class Student responsibilities Need for Attribute and/or operation Software Engineering OO Models Class Diagram Slide 17

CRC - Class Collaborator Collaboration takes one of two forms: A request for information or a request to do something. Example Alternative 1: The card Student requests an indication from the card Course whether a space is available, a request for information. Student then requests to be added to the Course, a request to do something. Alternative 2: Another way to perform this logic, however, would have been to have Student simply request Course to enroll himself (Student ) into itself (Course). Then have Course do the work of determining if a seat is available and, if so, then enrolling the student and, if not, then informing the student that he was not enrolled. Software Engineering OO Models Class Diagram Slide 18

Class diagrams Shows relationship between classes A class diagram may show: Relationship Generalization (inheritance) is a is a kind of Association (dependency) Aggregation Composition: Strong aggregation does Who does What uses has composed of Software Engineering OO Models Class Diagram Slide 19

Association, aggregation and composition When considering the 3 relationships, association, aggregation and composition, the most general relationship is association, followed by aggregation and, finally, composition. Software Engineering OO Models Class Diagram Slide 20

Association between classes Who does What Software Engineering OO Models Class Diagram Slide 21

Multiplicity of Relationships Software Engineering OO Models Class Diagram Slide 22

Class diagrams Abstract & Concrete classes and methods Abstract class: Has no objects Classes that provide no objects are said to be abstract classes. Its name in italics For common attributes/methods of 2 or more child classes Is always a parent class Should not appear below a concrete class in the hierarchy Concrete class: Has objects (instances) All objects are instances of concrete classes Abstract method: Has no implementation Concrete method : Has implementation Software Engineering OO Models Class Diagram Slide 23

Class diagrams Abstract & Concrete classes and methods Example: Shape A super class Shape has no implementation of abstract method Area() A sub class Square has an implementation of concrete method Area() A sub class Circle has an implementation of concrete method Area() Software Engineering OO Models Class Diagram Slide 24

Inheritance: is a is a kind of is a association. Child class subclass can inherit attributes and operations from parent class superclass. Example: An inheritance hierarchy in the animal kingdom Software Engineering OO Models Class Diagram Slide 25

Class name Attributes Is a Library item Catalogue number Acquisition date Cost Type Status Number of copies Acquire () Catalogue () Dispose () Issue () Return () Library class hierarchy Methods Operations Generalisation Is a Published item Title Publisher Recorded item Title Medium Book Author Edition Publication date ISBN Year Issue Magazine Film Director Date of release Distributor Computer program Version Platform

Library user Name Address Phone Registration # User class hierarchy Register () De-register () Reader Affiliation Borrower Items on loan Max. loans Staff Department Department phone Student Major subject Home address

Hierarchy Diagram (UMLUML notation) PERSON Name, Address Phone, Sex Date of Birth ChangeAddress EnquireDOB&Sex ISA CUSTOMER Balance O/Due 30, 60, 90 Credit Rating Date Paid CheckCrRating AgeBalances This kind of arrowhead indicates that this relationship is one of subclassing EMPLOYEE SIN Marital Status No. of Dependants Date Hired Wage Rate GiveRaise CalcMonthPay Software Engineering OO Models Class Diagram Slide 28

Generalization Naming Software Engineering OO Models Class Diagram Slide 29

Multiple inheritance Rather than inheriting the attributes and services from a single parent class, a system which supports multiple inheritance allows object classes to inherit from several super-classes Can lead to semantic conflicts where attributes/services with the same name in different super-classes have different semantics Makes class hierarchy reorganisation more complex Java does not support multiple inheritance Software Engineering OO Models Class Diagram Slide 30

Example: Multiple inheritance The talking book Book Author Edition Publication date ISBN Voice recording Speaker Duration Recording date Talking book # Tapes Software Engineering OO Models Class Diagram Slide 31

UML: Associations of regular classes Who does what relationship Association: Who does what Librarian works in Library When classes are connected together conceptually, that connection is called an association Software Engineering OO Models Class Diagram Slide 32

Associations of regular classes - Who does what A manager supervises 1..* employees An employee is supervised by 1 manager Manager 1 supervises 1..* is supervised by Employee Software Engineering OO Models Class Diagram Slide 33

Regular & Association classes Like a class, an association can have attributes and operations You visualize association class the same way you show a regular class Use dotted line to connect association class to the association line Regular class Regular class Associated class Software Engineering OO Models Class Diagram Slide 34

Multiplicity of an Association Shows the number of objects from one class that relate with a number of objects in an associated class. Software Engineering OO Models Class Diagram Slide 35

UML: Multiplicity One class can be relate to another in a: one-to-one one-to-many one-to-one or more one-to-zero or one one-to-a bounded interval (one-to-two through twenty) one-to-exactly n one-to-a set of choices (one-to-five or eight) The UML uses an asterisk (*) to represent more and to represent many. Software Engineering OO Models Class Diagram Slide 36

Association and Inheritance. Employee Manager 1 drives 1 supervises * Regular Employee * belongs to * Company Vehicle Association: Who does what 1 Union Software Engineering OO Models Class Diagram Slide 37

OO: Visibility of attributes or operations Visibility: specifies the extent to which other classes can use a given class's attributes or operations. Three levels of visibility: + : public level (usability extends to other classes) # : protected level (usability is open only to classes that inherit from original class) - : private level (only the original class can use the attribute or operation) Software Engineering OO Models Class Diagram Slide 38

OO: Visibility Ex: Public and private operations in a Hard Disk Software Engineering OO Models Class Diagram Slide 39

Ex: The character hierarchy The Character class will have ASCIIcode and type as attributes (type tells the type of the character - normal, italic, bold or underline), and normal(), bold(), italic() and underline() as operations. The Character class children will be: Letter, PunctualSign, SpecialCharacter and Number. Software Engineering OO Models Class Diagram Slide 40

Ex: Generalization/Specialization Hierarchy Notation for Motor Vehicles Software Engineering OO Models Class Diagram Slide 41

Object Aggregation Has-a relationship Structural: whole/part Peer relationship Whole & parts objects can exist independently A special form of association Software Engineering OO Models Class Diagram Slide 42

Object Aggregation: Peer relationship Whole & parts objects can exist independently Example: a bank (whole) has customers (as parts) Deleting a bank does not cascade deleting customers Customers can move to another bank Programming: whole contains an array of parts Software Engineering OO Models Class Diagram Slide 43

Object Aggregation Aggregation model shows how classes (which are collections) are composed of other classes. Similar to the part-of relationship in semantic data models. A line joins a whole to a part (component) with an open diamond on the line near the whole. Software Engineering OO Models Class Diagram Slide 44

Object Aggregation Example: An aggregation association in the TV Set system Every TV has a TV box, screen, speaker(s), resistors, capatitors, transistors, ICs... and possibly a remote control. Remote control can have these parts: resistors, capatitors, transistors, ICs, battery, keyboard and remote lights. Software Engineering OO Models Class Diagram Slide 45

Object aggregation has composed of Exercises #Problems Description 1..* Assignment Credits 1 1 1..3 0..3 Solutions Text Diagrams OHP slides Slides 1 1..* Study pack Course title Number Year Instructor 1 1 Text 1 14 Lecture notes part of Videotape Tape ids. 1 Software Engineering OO Models Class Diagram Slide 46

Composition A composite is a strong type of aggregation. Each component in a composite can belong to just one whole. The symbol for a composite is the same as the symbol for an aggregation except the diamond is filled. Software Engineering OO Models Class Diagram Slide 47

Composition - Example 1 Human's outside: Every person has: head, body, arms and legs. A composite association. In this association each component belongs to exactly one whole. Whole & parts objects can NOT exist independently Software Engineering OO Models Class Diagram Slide 48

Composition Example 2 A bank (whole) has many branches (parts) Branches can not exist independently of the whole (parts objects can NOT exist independently) Deleting a bank (whole) cascades deleting branches (parts) But, if a branch (part) is deleted, the bank (whole) may remain Software Engineering OO Models Class Diagram Slide 49

University Course Enrollment Design Class Diagram (With Methods) Software Engineering OO Models Class Diagram Slide 50

Example: Class Diagram Software Engineering OO Models Class Diagram Slide 51

Class diagram Example Reflexive association Association: Patient schedules (zero or more) Appointment Inverse Association: Appointment is associated with only one Patient + Role: Class related to itself Patient is primary insurance carrier of another patient (child, spouse) Association: Patient suffers (1 or more) Symptom Inverse Association: Symptom is suffered by (zero or more) Patient Software Engineering OO Models Class Diagram Slide 52

Class & Object diagrams - Example Class diagram Appt2: Appointment Object diagram Symptom2: Symptom Symptom3: Symptom Software Engineering OO Models Class Diagram Slide 53