Class Diagrams.

Slides:



Advertisements
Similar presentations
Object-oriented modeling Class/Object Diagrams
Advertisements

Stereotypes Stereotypes provide the capability to create a new kind of modeling element. –They can be used to classify or mark modeling elements. –A type.
CRC Modeling. Recap Class Modeling – How to Identify classes, its attributes and functions? – Class selection criteria – Relationships Associations Generalization.
Inheritance Java permits you to use your user defined classes to create programs using inheritance.
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. UML Class Diagrams2 Agenda What is a Class Diagram? Essential Elements of a UML Class Diagram Tips.
UML – Class Diagrams.
UML Class Diagram and Packages Written by Zvika Gutterman Adam Carmi.
UML Class Diagram and Packages Written by Zvika Gutterman Adam Carmi.
Chapter 14 (Web): Object-Oriented Data Modeling
UML Class Diagram and Packages
7M701 1 Class Diagram advanced concepts. 7M701 2 Characteristics of Object Oriented Design (OOD) objectData and operations (functions) are combined 
Chapter 10 Classes Continued
Modelling classes Drawing a Class Diagram. Class diagram First pick the classes –Choose relevant nouns, which have attributes and operations. Find the.
Chapter 14: Object-Oriented Data Modeling
OBJECT ORIENTED PROGRAMMING LECTURE 12 Instructor: Rashi Garg Coordinator: Gaurav Saxena.
Object-Oriented Software Development F Software Development Process F Analyze Relationships Among Objects F Class Development F Class Design Guidelines.
Lab 04.
CS3773 Software Engineering Lecture 04 UML Class Diagram.
Databases : Data Modeling 2007, Fall Pusan National University Ki-Joune Li.
Unit 1 INTRODUCTION TO MODELING AND CLASS MODEL Ref : L7-UML.PDF.
بسم الله الرحمن الرحيم ” اللهم أنت ربي لا إله إلا أنت خلقتني و أنا عبدك وأنا على عهدك ووعدك ما استطعت ، أعوذ بك من شر ما صنعت ، أبوء لك بنعمتك على و أبوء.
Unified Modeling Language © 2002 by Dietrich and Urban1 ADVANCED DATABASE CONCEPTS Unified Modeling Language Susan D. Urban and Suzanne W. Dietrich Department.
® IBM Software Group © 2006 IBM Corporation Rational Software France Object-Oriented Analysis and Design with UML2 and Rational Software Modeler 03. Classes,
Class-based Modeling.
SOFTWARE DESIGN AND ARCHITECTURE LECTURE 24. Review ANALYSIS Level Class Diagram – Identifying Entities – Identifying Attributes – Identifying Operations.
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.
An Introduction to the Unified Modeling Language
UML The Unified Modeling Language A Practical Introduction Al-Ayham Saleh Aleppo University
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.
Class Diagram. Classes Software Design (UML) Class Name attributes operations A class is a description of a set of objects that share the same attributes,
Design Model Lecture p6 T120B pavasario sem.
Chapter 3 Class Diagrams. 2 Outline Class Basics Class Basics Classes Classes Association Association Multiplicity Multiplicity Inheritance Inheritance.
CS212: Object Oriented Analysis and Design Lecture 33: Class and Sequence Diagram.
Class diagrams Terézia Mézešová.
Chapter 16 UML Class Diagrams 1CS6359 Fall 2012 John Cole.
ITEC0724 Modern Related Technology on Mobile Devices Lecture Notes #2 1.
UML Class Diagrams Sequence Diagrams CSE230 Dae-Kyoo Kim.
Class Diagram Lecture # 1. Class diagram A Class Diagram is a diagram describing the structure of a system shows the system's classes Attributes operations.
UML Fundamental Elements. Structural Elements Represent abstractions in our system. Elements that encapsulate the system's set of behaviors. Structural.
SUBCLASSES - JAVA. The Purpose of Subclasses Class Farm String getOwner() void setOwner(String s) int getSize() void setSize(int s) Class DairyFarm String.
Unified Modeling Language (UML)
Object-Oriented Modeling
Activity Diagram.
COMP 2710 Software Construction Class Diagrams
7.1 What Is An Object Object-oriented program - Description or simulation of application Object-oriented programming is done by adopting or extending an.
State Chart Diagrams.
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
Class diagram Description
UML Class & Object Diagram II
Software Engineering System Modeling Chapter 5 (Part 2) Dr.Doaa Sami
Inheritance B.Ramamurthy 11/7/2018 B.Ramamurthy.
UML Class Diagrams: Basic Concepts
Object Oriented Analysis and Design
Seminar 3 UML Class Diagram.
Lec 3: Object-Oriented Data Modeling
Software Engineering Lecture #11.
Object Oriented Analysis and Design Using the UML
2018, Fall Pusan National University Ki-Joune Li
UML Class Diagram.
Unified Modelling Language
Software Engineering System Modeling Extra examples Dr.Doaa Sami
Class Diagrams Class diagram is basically a graphical representation of the static view of the system and represents different aspects of the application.
Object Oriented System Design Class Diagrams
Information System Design
UML  UML stands for Unified Modeling Language. It is a standard which is mainly used for creating object- oriented, meaningful documentation models for.
From Class Diagram to Contract Diagram
2019, Fall Pusan National University Ki-Joune Li
Presentation transcript:

Class Diagrams

CLASS DIAGRAM *A class diagram defines the classes of objects in the system, the attributes and operations of the classes, and the relationships between classes. هذا الرسم يوضح مجموعة ال classes و كل من المتغيرات و الدوال الموجودة بها و العلاقة بينها *It is a static model, describing what exists and what attributes and behavior it has, rather than how something is done. هو احد طرق التمثيل الثابته التي تعرض مجموعه المتغيرات و الدوال دون وصف كيفية انجاز مهمه محدده

Essential Elements of a UML Class Diagram المكونات الاساسية لهذا النظام هي : Class. Attributes. Operations. Relationships. Associations. Aggregation & Composition. Generalization. Dependency.

Classes A class is the description of a set of objects having similar “attributes”, “operations”, relationships and behavior. ال class: هو وصف لمجموعه الحالات (objects) لها نفس المتغيرات و الدوال و العلاقات فيما بينها Class Name Drink Window Attributes Size: size Visibility: boolean Name:String Price:Double Display() hideI() Operations CheckDrink()

Modeling Visibility Visibility: An enumeration whose value (public, protected, package, or private) denotes how the model element to which it refers may be Seen outside its enclosing namespace. Its applied to both attributes and operations in a class الظهور: هو رقم بأخذ القيمه (public, protected, package, or private) لتوضيح كيفية ظهور مكونات ال class للاجزاء الاخرى من النظام و يتم اعطاء هذه القيمة للمتغيرات و الدوال على حد سوا Symbol Visibility Level - Private ~ Package + Public # Protected

Elements of class diagram… Class name compartment Client - companyAddress - companyEmail - companyFax + companyName # companyTelephone private Attributes compartment public Operations compartment + getClientInfo( ) protected - updateClientInfo( ) 6

Associations A semantic relationship between two or more classes that specifies connections among their instances. هي علاقة بين اثنين او اكثر من ال classes لبيان ان هنالك علاقة بينها او بين ال objects التابعه لها A structural relationship specifying that objects of one class are connected to objects of a second (possibly the same) class. Example: “An Employee works for a Company”.

Associations (cont.) An association between two classes indicates that objects at one end of an association “recognize” objects at the other end and may send messages to them. هذه العلاقة بين ال classes توضح ان كل منهما يتطيع التعرف علي متغيرات و دوال الثاني و يستطيع ارسال قيم له 1 3 Borrower Book currBorr bk[]

Association (Java implementation) public class Book { Borrower currBorr; public void setBorrower( Borrower bw ) { currBorr = bw; } public class Borrower { Book bk[]; int numBooks; … public Borrower() { numBooks = 0; bk = new Book[3]; } // methods that update bk public void borrowBook( Book b ) { bk[numBooks] = b; numBooks++; b.setBorrower( this );

Aggregation A special form of association that models a whole-part relationship between an aggregate (the whole) and its parts. Models a “is a part-part of” relationship. هي نوع خاص من العلاقات لبيان العلاقة بين الكل و اجزاءه 4 Car Wheel wheels Whole Part

Aggregation (Java implementation) public class Car { private Wheel wheels[]; ... // wheel objects are created externally and // passed to the constructor public Car( Wheel w1, Wheel w2, … ) { // we can check w1, w2, etc. for null // to make sure wheels exist wheels = new Wheel[4]; wheels[0] = w1; wheels[1] = w2; … }

Composition A strong form of aggregation: The whole is the sole owner of its part: The part object may belong to only one whole حيث ان الجزء ينتمي لكل واحد فقط Multiplicity on the whole side must be one نوع العلاقة بإتجاه الكل يجب ان تكون واحد The life time of the part is dependent upon the whole The composite must manage the creation and destruction of its parts في هذه العلاقة وجود الجزء او عدمه يعتمد على الكل حيث يتحكم في إنشاء و حذف الاجزاء Line Point 3..* 2 Polygon

Composition (Java implementations) public class Car { private Wheel wheels[]; ... public Car() { wheels = new Wheel[4]; // Wheels are created in Car … wheels[0] = new Wheel(); wheels[1] = new Wheel(); … }

Generalization relationship Indicates that objects of the specialized class (subclass) are substitutable for objects of the generalized class (super-class) “is kind of” relationship هذه العلاقة تبين ان subclass يمكن ان تحل محل ال super-class An abstract class Shape Super Class Generalization relationship Sub Class Circle

Generalization A sub-class inherits from its super-class: يرث الجزء الخصائص التالية: Attributes. متغيرات Operations. دوال Relationships.علاقات A sub-class may:ويمكن للجزء ايضا اضافة كل من Add attributes and operations. Add relationships. Refine (override) inherited operations.

Generalization (Java implementation) public abstract class Shape { public abstract void draw(); ... } public class Circle extends Shape { public void draw() { ... } ... }

processTransactions () Dependency A dependency indicates a semantic relation between two or more classes in which a change in one may force changes in the other although there is no explicit association between them علاقة الاعتمادية: هي نوع من العلاقات يبين ان التغيرعلى احد المشاركين في العلاقة يجبرنا علي تغير الاخر حتى و ان لمن توجد علاقة مباشرة بين الاثنين A stereotype may be used to denote the type of the dependency Parser getTransaction() uses Bank processTransactions ()

Dependency (Java implementation) public class Bank { … public void processTransactions() // Parser p is a local variable … Parser p = new Parser(…); p.getTransaction(); }

<<interface>> List Realization A realization relationship indicates that one class implements a behavior specified by another class (an interface or protocol). هذا العلاقة تعني ان احد ال classes يقوم بتعريف مكونات دوال class اخر An interface can be realized by many classes. A class may realize many interfaces. LinkedList <<interface>> List LinkedList List

Realization (Java implementation) public interface List { boolean add(Object o); ... } public class LinkedList implements List { public boolean add(Object o) { ... } ... }

Basic Class Diagrams Class A Superclass Class with parts Class with Interface name Class B Subclass Assembly Class Assembly Class Concrete Class Association (relationship) Inheritance (Generalization) (is-a, kind-of) Aggregation (Part-Of) Dependency Realization

Multiplicity The number of instances of the class, next to which the multiplicity expression appears, that are referenced by a single instance of the class that is at the other end of the association path. عدد الحالات من class محدد تظهر على كل طرف من سهم العلاقة لبيان نوعها Indicates whether or not an association is mandatory. توضح هل العلاقة اجبارية ام لا Provides a lower and upper bound on the number of instances. توضح اعلى و اقل قيم يمكن ان تأخدها العلاقة

Multiplicity Indicators انواع العلاقات (طرق تمثيلها) Exactly one 1 Zero or more (unlimited) * (0..*) One or more 1..* Zero or one (optional association) 0..1 Specified range 2..4

Computer: Computer PrintServer: PrintServer Printer: Printer Queue: Queue User: User print (filename) print(file) [printer free] print(file) [printer busy] store(file)

Computer PrintServer Printer uses Managed by Queue status(): integer print(file) uses print(filename) print(file) Managed by Queue store(file)