UML and Classes, Objects and Relationships [2]

Slides:



Advertisements
Similar presentations
ER Model For a college DB
Advertisements

UML and Classes, Objects and Relationships [1]
UML (cont.) “The Unified Modeling Language User Guide” by G. Booch, J. Rumbaugh and I. Jacobson ● Classes ● Relationships ● Class diagrams ● Examples.
UML CLASS DIAGRAMS.
Object-oriented modeling Class/Object Diagrams
Copyright © 2015 Pearson Education, Inc. Database Design Chapters 17 and
Text-Book Chapters (7 and 8) Entity-Relationship Model
UML Class Diagram and Packages Written by Zvika Gutterman Adam Carmi.
UML Class Diagram. UML Class Diagrams2 Agenda What is a Class Diagram? Essential Elements of a UML Class Diagram Tips.
UML Class Diagram and Packages Written by Zvika Gutterman Adam Carmi.
UML Class Diagram and Packages Written by Zvika Gutterman Adam Carmi.
UML Class Diagram and Packages
Basic OOP Concepts and Terms
7M822 UML Class Diagrams advanced concepts 15 September 2008.
1 Data Modelling Which data to include in the database.
UML CLASS DIAGRAMS. Basics of UML Class Diagrams What is a UML class diagram? Imagine you were given the task of drawing a family tree. The steps you.
Ch5: ER Diagrams - Part 2 Much of the material presented in these slides was developed by Dr. Ramon Lawrence at the University of Iowa.
Entity-Relationship Diagrams
Entity-Relationship Modeling I The cautious seldom err. Confucius.
DeSiamorewww.desiamore.com/ifm1 Database Management Systems (DBMS)  B. Computer Science and BSc IT Year 1.
Systems Analysis and Design in a Changing World, Tuesday, Feb 27
Lawrence ChungCS6359.0T1: Module 41 Module 4: Relationships.
Chapter 11 Inheritance and Composition. Chapter Objectives Learn about inheritance Learn about subclasses and superclasses Explore how to override the.
Module Title? Data Base Design 30/6/2007 Entity Relationship Diagrams (ERDs)
Principles of Database Design, Part II AIMS 2710 R. Nakatsu.
UML Diagrams: Class Diagrams The Static Analysis Model Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical Engineering, WVU.
Object-Oriented Software Development F Software Development Process F Analyze Relationships Among Objects F Class Development F Class Design Guidelines.
Systems Analysis and Design in a Changing World, 6th Edition 1 Chapter 4 Domain Classes.
University of Toronto Department of Computer Science © Steve Easterbrook. This presentation is available free for non-commercial use with attribution.
© 2009 Pearson Education, Inc. Publishing as Prentice Hall 1 Chapter 15: Object-Oriented Data Modeling Modern Database Management 9 h Edition Jeffrey A.
Unit 3 Conceptual Data Modeling. Key Concepts Conceptual data modeling process Classes and objects Attributes Identifiers, candidate keys, and primary.
Databases : Data Modeling 2007, Fall Pusan National University Ki-Joune Li.
CHAPTER 13: OBJECT-ORIENTED DATA MODELING (OVERVIEW) © 2013 Pearson Education, Inc. Publishing as Prentice Hall 1 Modern Database Management 11 th Edition.
® IBM Software Group © 2006 IBM Corporation Rational Software France Object-Oriented Analysis and Design with UML2 and Rational Software Modeler 03. Classes,
The Static Analysis Model Class Diagrams Prof. Hany H. Ammar, CSEE, WVU, and Dept. of Computer Science, Faculty of Computers and Information, Cairo University.
UML Class Diagram Trisha Cummings. What we will be covering What is a Class Diagram? Essential Elements of a UML Class Diagram UML Packages Logical Distribution.
Software Design Software Design (UML) Static Modeling using the Unified Modeling Language (UML) Material based on [Booch99, Rambaugh99, Jacobson99, Fowler97,
Polymorphism, Abstraction and Virtual Functions. In this slide, we introduce virtual functions and two complex and powerful uses for derived classes that.
Basic OOP Concepts and Terms. In this class, we will cover: Objects and examples of different object types Classes and how they relate to objects Object.
DeSiamorePowered by DeSiaMore1 Database Management Systems (DBMS)  B. Computer Science and BSc IT Year 1.
Msigwaemhttp//:msigwaem.ueuo.com/1 Database Management Systems (DBMS)  B. Computer Science and BSc IT Year 1.
Lecture 1: UML Class Diagram September 12, UML Class Diagrams2 What is a Class Diagram? A class diagram describes the types of objects in the system.
Peyman Dodangeh Sharif University of Technology Fall 2014.
Design Model Lecture p6 T120B pavasario sem.
Object Oriented Analysis: Associations. 2 Object Oriented Modeling BUAD/American University Class Relationships u Classes have relationships between each.
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. Weak entity meets.
Domain Modeling Yonglei Tao.
Class Modeling Design Class diagram. Classes The term “class ” refers to a group of objects that share a common attributes and common behaviour (operations).
Java Programming Dr. Randy Kaplan. Abstract Classes and Methods.
CSCI-383 Object-Oriented Programming & Design Lecture 10.
advanced data modeling
UML Class Diagram. A class diagram shows 1.Classes 2.The relationships between them.
CS212: Object Oriented Analysis and Design Lecture 33: Class and Sequence Diagram.
Class diagrams Terézia Mézešová.
School of Computer Science and Engineering
Entity Relationship Diagram (ERD). Objectives Define terms related to entity relationship modeling, including entity, entity instance, attribute, relationship.
Object Modeling THETOPPERSWAY.COM. Object Modelling Technique(OMT)  Building a model of an application domain and then adding implementation.
CHAPTER 13: OBJECT-ORIENTED DATA MODELING (OVERVIEW) Modern Database Management 11 th Edition Jeffrey A. Hoffer, V. Ramesh, Heikki Topi © 2013 Pearson.
Class Diagram Slide 1 1. Objective  Introduces the evolutionary approach for building classes  Explain how to identify objects and attributes of classes.
ENTITY RELATIONSHIP DIAGRAM. Objectives Define terms related to entity relationship modeling, including entity, entity instances, attribute, relationship.
ENTITY-RELATIONSHIP MODELLING. Objectives: How to use Entity–Relationship (ER) modelling in database design. Basic concepts associated with ER model.
Entity Relationship (E-R) Model
UML Diagrams: Class Diagrams The Static Analysis Model
Interface, Subclass, and Abstract Class Review
Introduction to Object Oriented Analysis, Design and Unified Modeling Language (UML) Shanika Karunasekera.
Seminar 4 UML Object Diagram.
Interfaces Interface is a conceptual entity similar to a Abstract class. Can contain only constants (final variables) and abstract method (no implementation)
Data Modeling with Entity Relationship Diagrams (Cont.)
Unified Modelling Language
Database EER.
Presentation transcript:

UML and Classes, Objects and Relationships [2] Defining Domain Models Using Class Diagrams

Agenda Class Relationships and UML Notations Class Diagram Association - DONE Generalization Realization Dependency Class Diagram Object Diagram Summary

Association - Multiplicity A Student can take many Courses and many Students can be enrolled in one Course. Student Course takes * * 254: Course Alice: Student 1. 253: Course Jill: Student

Notes 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)

Notes Multiplicity can be expressed as, Exactly one - 1 Zero or one - 0..1 Many - 0..* or * One or more - 1..* Exact Number - e.g. 3..4 or 6 Or a complex relationship – e.g. 0..1, 3..4, 6..* would mean any number of objects other than 2 or 5

Association - Self An association that connects a class to itself is called a self association. 1.

Association - Self Employee A Company has Employees. A single manager is responsible for up to 10 workers. Employee 1 manager 1. Responsible for worker 0..10

Association - Multiplicity A cricket team has 11 players. One of them is the captain. A player can play only for one Team. The captain leads the team members. Captain Team Team Member Player 1 0..1 1. 10 member of 1 11 Captain 1 Leads

Class Relationships Association Generalization Realization Dependency

Generalization (Inheritance) Child class is a special case of the parent class SuperClass SubClass1 SubClass2

Generalization (Inheritance) e.g. Circle GraphicCircle

Inheritance - Implementation public class Circle { } public class GraphicCircle extends Circle {

Abstract Class Shape Circle Rectangle If the class is defined as Abstract no objects of the class can be instantiated. If at least one method in a class is defined as abstract then the class is abstract.

Abstract Methods (Operations) Shape draw() Circle Rectangle If the class is defined as Abstract no objects of the class can be instantiated. If at least one method in a class is defined as abstract then the class is abstract. draw() draw()

Abstract class and method Implementation public abstract class Shape { public abstract draw(); //declare without implementation ……… } public class Circle { public draw(){ ……. …..

Class Relationships Association Generalization Realization Dependency

Realization- Interface Interface is a set of operation the class carries out ctl() pageDown() brandName numOfKeys Keyboard TypeWriter <<interface>> TypeWriter ctl() pageDown() brandName numOfKeys Keyboard keyStroke() OR An interface does not have attributes. Only operations. The computer's keyboard is a reusable interface. Its keystroke operation has been reused from the typewriter. The placement of keys is the same as on a typewriter, but the main point is that the keystroke operation has been transferred from one system to another. Also on computer's keyboard you'll find a number of operations that you won't find on a typewriter (Ctrl, Alt, PageUp, PageDown...)  The relationship between a class and an interface is called realization.

Realization - Implementation public interface TypeWriter { void keyStroke() } public class KeyBoard implements TypeWriter { public void keyStroke(){ ………

Class Relationships Association Generalization Realization Dependency

Dependency Change in specification of one class can change the other class. This can happen when one class is using another class. Circle Point Move(p:Point)

Dependency cont Dependency relationship can be used to show relationships between classes and objects. circleA:Circle <<instanceOf>> Circle circleB:Circle <<instanceOf>>

Class Diagrams The UML class diagram consists of several Classes, connected with Relationships.

Class Diagram - Example Draw a class diagram for a information modeling system for a school. School has one or more Departments. Department offers one or more Subjects. A particular subject will be offered by only one department. Department has instructors and instructors can work for one or more departments. Student can enrol in upto 5 subjects in a School. Instructors can teach upto 3 subjects. The same subject can be taught by different instructors. Students can be enrolled in more than one school.

Class Diagram - Example School has one or more Departments. School Department has 1 1..* Department offers one or more Subjects. A particular subject will be offered by only one department. Department Subject offers 1 1..*

Class Diagram - Example Department has Instructors and instructors can work for one or more departments. assigned to 1..* Instructor Department Student can enrol in upto 5 Subjects. Student Subject takes * 0..5

Class Diagram - Example Instructors can teach up to 3 subjects. The same subject can be taught by different instructors. Instructor Subjects teaches 1..* 1..3

Class Diagram - Example Students can be enrolled in more than one school. Student School member * 1..*

Class Diagram Example Department School 1…* Instructor Subject Student has School Department 1 1..* 1..* 1…* 1 offeres assignedTo member 1..* 1..* * Instructor Student attends Subject teaches * 1..5 1..3 1..*

Object Diagram Object Diagram shows the relationship between objects. Unlike classes objects have a state.

Object Diagram - Example c1: Company name=“UniMelb” c1: Company d1: Department d2: Department name=“Sales” name=”CSSE” manager employee p2: Person p1: Persont name=“Raj” name=“Rao”

Summary We have discussed the following concepts and UML notations related: Association Generalization Realization Dependency How to create a Class Diagram that contains all the above relationships Object Diagram for Uni.Dept.system.