Software Systems Design – 3 Class Diagrams (static structure) Klaas Sikkel Software SystemsDesign - 31.

Slides:



Advertisements
Similar presentations
Entity Relationship Diagrams
Advertisements

Database Design Lessons 2 & 3 Database Models, Entities, Relationships.
Chapter 6: Entity-Relationship Model (part I)
Database Design The process of finding user requirement
Object-oriented modeling Class/Object Diagrams
Ch5: ER Diagrams - Part 1 Much of the material presented in these slides was developed by Dr. Ramon Lawrence at the University of Iowa.
Use Case Diagram © copyright 2001 SNU OOPSLA Lab..
Design Principles: Faithfulness
Lecturer: Sebastian Coope Ashton Building, Room G.18 COMP 201 web-page: Lecture.
UML Class Diagram and Packages Written by Zvika Gutterman Adam Carmi.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 7 Data Modeling Using the Entity- Relationship (ER) Model.
ENTITY RELATIONSHIP DATA MODEL ELIZABETH GEORGE. INTRODUCTION Architect Aeronautical engineers Computer architects Traffic engineers.
Enhanced ER modeling techniques Transparencies
UML Notations Activity diagrams State diagrams Class diagrams Use-case diagrams.
Database Design Concepts Lecture 7 Introduction to E:R Modelling Identifying Entities.
UML Class Diagrams: Basic Concepts. Objects –The purpose of class modeling is to describe objects. –An object is a concept, abstraction or thing that.
Chapter 4 The Enhanced Entity-Relationship (EER) Model
Specialization and generalization
Enhanced Entity-Relationship and UML Modeling. Enhanced-ER (EER) Model Concepts Includes all modeling concepts of basic ER Additional concepts: subclasses/superclasses,
Enhanced Entity-Relationship Model (EER) 1. Enhanced-ER (EER) Model Concepts Includes all modeling concepts of basic ER Additional concepts: subclasses/superclasses,
Data Modeling Using the Entity-Relationship Model
Chapter 9 Domain Models. Domain Model in UML Class Diagram Notation A “visual dictionary”
Ch5: ER Diagrams - Part 2 Much of the material presented in these slides was developed by Dr. Ramon Lawrence at the University of Iowa.
CSE314 Database Systems Data Modeling Using the Entity- Relationship (ER) Model Doç. Dr. Mehmet Göktürk src: Elmasri & Navanthe 6E Pearson Ed Slide Set.
ZEIT2301 Design of Information Systems Structural Design: Class Diagrams School of Engineering and Information Technology Dr Kathryn Merrick.
Practical Object-Oriented Design with UML 2e Slide 1/1 ©The McGraw-Hill Companies, 2004 PRACTICAL OBJECT-ORIENTED DESIGN WITH UML 2e Chapter 2: Modelling.
C++ Object Oriented 1. Class and Object The main purpose of C++ programming is to add object orientation to the C programming language and classes are.
Entities and Attributes
1 Data Modeling : ER Model Lecture Why We Model  We build models of complex systems because we cannot comprehend any such system in its entirety.
OBJECT AND CLASES: THE BASIC CONCEPTS Pertemuan 8 Matakuliah: Konsep object-oriented Tahun: 2009.
UML Notations in CommonKADS Activity diagrams State diagrams Class diagrams Use-case diagrams.
PowerPoint Presentation for Dennis, Wixom, & Tegarden Systems Analysis and Design with UML, 4th Edition Copyright © 2012 John Wiley & Sons, Inc. All rights.
UML Diagrams: Class Diagrams The Static Analysis Model Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical Engineering, WVU.
© Shamkant B. Navathe CC. © Shamkant B. Navathe CC Chapter 4 - Part I Enhanced Entity-Relationship and UML Modeling Copyright © 2004 Ramez Elmasri and.
Jan 21, Ron McFadyen1 Ch 10. Domain Model: Visualizing Concepts Domain model illustrated with a class diagram (with no operations defined)
CS3773 Software Engineering Lecture 04 UML Class Diagram.
© 2009 Pearson Education, Inc. Publishing as Prentice Hall 1 Chapter 15: Object-Oriented Data Modeling Modern Database Management 9 h Edition Jeffrey A.
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.
Entity-Relationship (ER) Modelling ER modelling - Identify entities - Identify relationships - Construct ER diagram - Collect attributes for entities &
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.
ITEC 3220A Using and Designing Database Systems Instructor: Prof Z. Yang Course Website: 3220a.htm
Design Model Lecture p6 T120B pavasario sem.
UNIT_2 1 DATABASE MANAGEMENT SYSTEM[DBMS] [Unit: 2] Prepared By Lavlesh Pandit SPCE MCA, Visnagar.
DOMAIN MODEL: ADDING ATTRIBUTES Identify attributes in a domain model. Distinguish between correct and incorrect attributes.
Enhanced Entity-Relationship (EER) Modeling. Slide 4- 2 Chapter Outline EER stands for Enhanced ER or Extended ER EER Model Concepts Includes all modeling.
 Week08.  Review Schedule Weeks 8-14  This week o Review last class o Introduce Class Diagrams o ICE-03 Sheridan SYST Engineering Quality Systems.
Introduction to c++ programming - object oriented programming concepts - Structured Vs OOP. Classes and objects - class definition - Objects - class scope.
CSCI-383 Object-Oriented Programming & Design Lecture 10.
Keys for Relationship Sets The combination of primary keys of the participating entity sets forms a super key of a relationship set. – (customer-id, account-number)
Data Modeling Using the Entity-Relationship (ER) Data Model.
Data Modeling Using the Entity- Relationship (ER) Model.
Domain Model A representation of real-world conceptual classes in a problem domain. The core of object-oriented analysis They are NOT software objects.
Slide 4-1 Elmasri and Navathe, Fundamentals of Database Systems, Fourth Edition Revised by IB & SAM, Fasilkom UI, 2005 Exercise 1. a property or description.
© Shamkant B. Navathe CC Enhanced Entity-Relationship Copyright © 2004 Ramez Elmasri and Shamkant Navathe.
Topic 4 - Part I Enhanced Entity-Relationship and UML Modeling
1 CS 430 Database Theory Winter 2005 Lecture 3: A Fifty Minute Introduction to Data Modeling.
Chapter 4_part2: The Enhanced Entity-Relationship (EER) Model.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 7 Lecture # 16 July 26,2012 Data Modeling using the Entity Relationship.
Databases (CS507) CHAPTER 7.
Enhanced Entity-Relationship (EER) Model
Enhanced Entity-Relationship and Object Modeling Objectives
Session 2 Welcome: The sixth learning sequence
Enhanced ER Modeling Transparencies
ER MODEL Lecture 3.
IS6145 Database Analysis and Design Lecture 5: Enhanced Entity-Relationship (EER) Modeling Rob Gleasure
MIS2502: Data Analytics Relational Data Modeling
CS4222 Principles of Database System
ITEC 3220A Using and Designing Database Systems
Sampath Jayarathna Cal Poly Pomona
Presentation transcript:

Software Systems Design – 3 Class Diagrams (static structure) Klaas Sikkel Software SystemsDesign - 31

Today’s topic Software SystemsDesign - 32

Contents 1.What is object-orientation? 2.(Static) class diagrams 3.What does a class diagram represent? 4.Extensions to class diagrams 4.1. Association classes 4.2. Generalization Software SystemsDesign - 33

1. What is object-orientation? Software SystemsDesign - 34

What is object-orientation? Philosophical perspective: A way to understand how concepts are structured in the world – Generalization / Specialization A tiger is a cat – Subspecies include Bengal, Sumatran and Siberian tiger A cat is a mammal A mammal is a vertebrate All cats have something in common that they do not share with other mammals Software SystemsDesign - 35

What is object-orientation? Philosophical perspective: A way to understand how concepts are structured in the world – The concept “cat” describes a set of individual animals that share certain properties (Class vs. Object) Software SystemsDesign - 36

What is object-orientation? Programming / Software Engineering perspective: A programming paradigm in which functionalities are assigned to particular kinds of data – Supports polymorhism – Supports information hiding Software SystemsDesign - 37

Example of a class Software SystemsDesign - 38

Pre-object-oriented programming Oversimplification: In the early days of programming, the focus was mostly on programming logic. What happened to the data depended on the logic. In object-oriented programming the data are more central and the programming logic depends on the (type of) data. Software SystemsDesign - 39

Polymorphism Software SystemsDesign - 310

Information hiding One cannot directly access an object’s data; one can only access the data through a method Consequence: Makes software easier to scale up Makes software easier to maintain Software SystemsDesign - 311

2. (Static) class diagrams Software SystemsDesign - 312

2. (Static) Class diagrams A class diagram is used to describe – What the objects are that should be stored in the system – How these objects are structured – How these objects relate to each other –(Not: what functionality these objects offer) Software SystemsDesign - 313

Simple example Software SystemsDesign CD for (part of) a company’s administration

Class vs. Object Class Describes what we want to know about an employee Object Stores data of one particular employee Software SystemsDesign - 315

Elements of a CD (1): Class Notation:Example: N.B.: class name is a singular noun Software SystemsDesign - 316

Elements of a CD (2): Attributes A class has zero or more attributes For every attribute a standard data type can be specified – Can be omitted if the data type is obvious and/or not interesting in a given context Standard data types include: - Integer- Date - Real- Time - Boolean- Money - String Software SystemsDesign - 317

Elements of a CD (3): Association (Notation will be elaborated on next slides) multiplicities (Elements between brackets[ ] are optional) name Direction of the association role of Class 2 in the association Software SystemsDesign - 318

Examples An employee lives at an address At any address zero or more employees are living Software SystemsDesign - 319

Examples An employee lives at an address At any address one or more employees are living Software SystemsDesign - 320

Examples Multiple associations between two classes Software SystemsDesign - 321

Examples Software SystemsDesign - 322

Multiplicities Software SystemsDesign - 323

Roles in an association Consider the following CD Software SystemsDesign - 324

Roles in an association We can use a role name, rather than association name, if a class has a specific role in the association Software SystemsDesign - 325

Direction of an association An association has a direction ( by default: – from left to right – from top to bottom We can explicitly indicate direction with, ^, v Software SystemsDesign - 326

Direction of an association Software SystemsDesign - 327

Conventions for associations In principle, every association has a name. If a role is indicated, the association name can be discarded By default an association is read from left to right or top to bottom A direction can be stated explicitly by ‘ ’, ‘^’, ‘v’ All multiplicities are explicitly given Software Systems28Design - 3

3. What does a class diagram represent? Software SystemsDesign - 329

CD as a model of the physical world [Lecture 1]: A model is a simplified representation of part of the world, from a particular view For Class Diagrams specifically: View: Focus on data (not functions/behaviour) Part of the world: The subject we’re modelling Simplified: Only those data that should be represented in the system Software SystemsDesign - 330

CD as a model of the physical world John Smith Representation of John Smith in the system Software SystemsDesign - 331

Is the model an adequate representation? Possibly reality is not correctly represented in the system – John Smith moved to a new address but no-one told the system This does not invalidate the class diagram There are models in which reality cannot be represented – “Every employee works at one particular department”: What to do if someone has two part-time jobs at different departments? Software SystemsDesign - 332

Which is the right model of an address? Design - 333Software Systems

Class and identity Two different objects can have the same values for all attributes Internally they are distinguished by a different key Such keys are not represented in the class diagram – unless these keys have spilled over into reality and now exist outside the system (student number, social security number, etc., … Software SystemsDesign - 334

Snapshot vs. historic information Do we model the world as it exists now, or do we include data from the past? This is a conscious choice. Usually snapshot, sometimes historic information (in exercises it is always clear what was meant) Example of a snapshot: Employee has one adres, one manager Example of historic information: Incidents in the police information system. They will remain to be recorded after the incident has been dealt with. Software SystemsDesign - 335

Class or attribute? Rule of the thumb: An entity is an attribute if it is only used as a particular data item of a class An entity is a class – If it can have multiple values – If it has attributes by itself – If it has associations with other classes Software SystemsDesign - 336

Pitfalls Synonyms (different words for the same concept) Homonyms (one word for different concepts) Software SystemsDesign - 337

Different levels of abstraction Special case of homonym We use one word for a concept on different levels of abstraction – The book ‘Bonita Avenue’ – One copy of the book ‘Bonita Avenue’ – The Alfa Romeo 159 (type of car) has certain properties – The Alfa Romeo 159 (particular car) which is parked in front of this building Software SystemsDesign - 338

Different levels of abstraction This distinction is important! And it remains to be difficult! Software SystemsDesign - 339

Yet another example Member wants to reserve a book. The system says that it has been borrowed by someone and will Be returned in two weeks. However, there are two copies still in the library. Reservations and loans in a library Inappropriate model: Impossible to indicate multiple copies of the Same book Software SystemsDesign - 340

Compare ‘Car’ and ‘Car type’ Yet another example Reservations and loans in a library Software SystemsDesign - 341

4.1 Association classes Software SystemsDesign - 342

Problem How can we assign a grade to the test? Software SystemsDesign - 343

Association class: Example Software SystemsDesign - 344

Identity of an association class The identity of an object of an association class is defined as combination of the identity of the associated objects. That means: – One ‘participation’ is identified by the combination of one student and one exam Software SystemsDesign - 345

Elements of a CD (4): Association class Software SystemsDesign - 346

Associatieclass vs. class Are these models equivalent? (b) (a) Software SystemsDesign - 347

Identity of an association class Identity is combination of the identities of the associated classes That implies, for (a): – A contract is defined by a unique combination of employee and company – Differently stated: For a combination of one person and one company there can only be a single contract But in case (b): – A person and a company can have multiple contracts Software SystemsDesign - 348

For a student who participates in an exam there is exactly one grade Software SystemsDesign - 349

A last example Marriage: snapshot viewMarriage: historical view Software SystemsDesign - 350

Special case: Liz Taylor & Richard Burton Married: 15 March 1964 — Divorced 26 June 1974 Married: 10 October 1975 — Divorced: 29 July 1976 Design - 3

Liz Taylor & Richard Burton Inadequate model Adequate model Software SystemsDesign - 352

4.2 Generalization Software SystemsDesign - 353

Generalization example Software SystemsDesign - 354

Elements of a CD (5): generalization Elements: discriminator static/dynamic dc / d / c / _ Class 1 is the superclass of Classes 2 and 3 Class 3 is a subclass of Class 1 Design - 3

Elements of generalizations (1) Discriminator – discriminator is one of the attributes of the super class >/ > – Static: an object cannot chance subclass Example: a bicycle never becomes a car – Dynamic: an object could belong to different subclasses at different moments in time Example: student graduates and becomes employee Software SystemsDesign - 356

Elements of generalizations (2) Disjoint generalization: an object can belong to at most one subclass Not disjoint: anobject can belong to different subclasses at the same time (student assistant is both student and employee) Covering generalization: every object of the superclass belongs to (at least) one subclass Not covering: there can be objects that don’t belong to any subclass (external staff; is in the database but not an employee) Software SystemsDesign - 357

Disjoint and covering dc d c ? Software SystemsDesign - 358

Use of generalization We use a generalization if … …subclasses can be distinguised that have different attributes … subclasses can be distinguished that have different associations Software SystemsDesign - 359

Use of Generalization Different attributes for ‘Student’ and ‘Teacher’ Software SystemsDesign - 360

Use of Generalization Different assocations for ‘Student’ and ‘Teacher’ Software SystemsDesign - 361

Use of Generalization Contains the same information as the previous slide (Subclass without attributes can be deleted) Software SystemsDesign - 362

Generalization: more examples Design - 3

Generalization: more examples Design - 3

Self-study and Laboratory exercise Please note: The self-study prepares for the lab exercise There is good reason for that: Wednesday’s lab exercise is quite challenging So do your homework and be prepared! Software SystemsDesign - 365