CS 2511 Fall 2014. UML Diagram Types  2 Main Types Structure Diagrams ○ Class Diagrams ○ Component Diagrams ○ Object Diagrams Behavior Diagrams ○ Sequence.

Slides:



Advertisements
Similar presentations
INTERFACES IN JAVA 1.Java Does not support Multiple Inheritance directly. Multiple inheritance can be achieved in java by the use of interfaces. 2.We need.
Advertisements

***** SWTJC STEM ***** Chapter 4-1 cg 42 Object Oriented Program Terms Up until now we have focused on application programs written in procedural oriented.
CS 340 UML Class Diagrams. A model is an abstraction of a system, specifying the modeled system from a certain viewpoint and at a certain level of abstraction.
UML Class and Sequence Diagrams Violet Slides adapted from Marty Stepp, CSE 403, Winter 2012 CSE 403 Spring 2012 Anton Osobov.
2-1 © Prentice Hall, 2007 Chapter 2: Introduction to Object Orientation Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph.
1 Software Testing and Quality Assurance Lecture 12 - The Testing Perspective (Chapter 2, A Practical Guide to Testing Object-Oriented Software)
UML – Class Diagrams.
Design Patterns in Java Appendix D UML at a Glance Summary prepared by Kirk Scott 1.
Basic OOP Concepts and Terms
Essentials of interaction diagrams Lecture Outline Collaborations Interaction on collaboration diagrams Sequence diagrams Messages from an object.
Inheritance COMP53 Sept Inheritance Inheritance allows us to define new classes by extending existing classes. A child class inherits all members.
7M701 1 Class Diagram advanced concepts. 7M701 2 Characteristics of Object Oriented Design (OOD) objectData and operations (functions) are combined 
©TheMcGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 1 Introduction to Object-Oriented Programming and Software Development.
SE-565 Software System Requirements More UML Diagrams.
Object-oriented design Part 4: More UML. Interfaces An interface is a language construct specific to Java Java does not support multiple inheritance Interfaces.
Unified Modeling Language
Unified Modeling Language
The Unified Modeling Language (UML) Class Diagrams.
Object-Oriented Analysis and Design
CS 2511 Fall UML Diagram Types  2 Main Types Structure Diagrams ○ Class Diagrams ○ Component Diagrams ○ Object Diagrams Behavior Diagrams ○
Using Jeroo To Teach Object-Oriented Concepts By Christian Digout.
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.
ITEC 370 Lecture 10 Design. Review Design –Why is it part of the process? –Who is the audience for design?
Programming in Java Unit 2. Class and variable declaration A class is best thought of as a template from which objects are created. You can create many.
Chapter Two The UML – Unified Modeling Language Ku-Yaw Chang Assistant Professor, Department of Computer Science and Information.
Centre for Computer Technology ICT214 Object Oriented Design and Programming Week 02 – Classes, Objects, Instances Richard Salomon and Umesh Patel Centre.
UML Class Diagrams 1 These lecture slides are copyright (C) Marty Stepp, They may not be rehosted, sold, or modified without expressed permission.
An Introduction to the Unified Modeling Language
UML The Unified Modeling Language A Practical Introduction Al-Ayham Saleh Aleppo University
Design Jon Walker. More UML ● What is UML again?
Peyman Dodangeh Sharif University of Technology Fall 2014.
CS 151: Object-Oriented Design September 5 Class Meeting Department of Computer Science San Jose State University Spring 2013 Instructor: Ron Mak
Design Model Lecture p6 T120B pavasario sem.
CSE 403, Spring 2008, Alverson Using UML to express Software Architecture.
CSE 403, Spring 2007, Alverson Using UML to express Software Architecture.
Introduction to UML CS A470. What is UML? Unified Modeling Language –OMG Standard, Object Management Group –Based on work from Booch, Rumbaugh, Jacobson.
Everything is an object (CH-2) Manipulating Objects with References. Manipulating Objects with References. String s; String s = “IS2550” String s = new.
Software Engineering Lecture 8 Object-Oriented Analysis.
CSE 219 Computer Science III UML. UML Diagrams UML - Unified Modeling Language UML diagrams are used to design object-oriented software systems –represent.
Inheritance CSI 1101 Nour El Kadri. OOP  We have seen that object-oriented programming (OOP) helps organizing and maintaining large software systems.
Application development with Java Lecture 21. Inheritance Subclasses Overriding Object class.
CS212: Object Oriented Analysis and Design Lecture 33: Class and Sequence Diagram.
UML Part 1: Class Diagrams. Introduction UML stands for Unified Modeling Language. It represents a unification of the concepts and notations presented.
Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall Object-Oriented Systems Analysis and Design Using UML Systems Analysis and Design,
Chapter 5 System Modeling. What is System modeling? System modeling is the process of developing abstract models of a system, with each model presenting.
INFSY 535.  Small systems  Larger systems 1.Understand the program requirement- what 3. Write and test each part (unit testing) 4. Maintenance 2. Specify.
Chapter 3: Introducing the UML
CS 2511 Fall UML Diagram Types  2 Main Types Structure Diagrams ○ Class Diagrams ○ Component Diagrams ○ Object Diagrams Behavior Diagrams ○ Sequence.
Object Oriented Programming and Data Abstraction Earl Huff Rowan University.
Unified Modeling Language (UML)
UML Fundamental Elements. Structural Elements Represent abstractions in our system. Elements that encapsulate the system's set of behaviors. Structural.
CS 501: Software Engineering Fall 1999 Lecture 15 Object-Oriented Design I.
Introduction to UML and Rational Rose UML - Unified Modeling Language Rational Rose 98 - a GUI tool to systematically develop software through the following.
Sadegh Aliakbary Sharif University of Technology Fall 2010.
COP 3330 Notes 4/13. Today’s Topics UML Class Diagrams.
Class Inheritance Part I
Unified Modeling Language
Object-Oriented Analysis and Design
An Introduction to Inheritance
UML PPt by: Hong Qing Yu.
The Basics of Class Diagrams for a single class
Corresponds with Chapter 7
Interface.
Advanced Programming Behnam Hatami Fall 2017.
Basics of OOP A class is the blueprint of an object.
Basic OOP Concepts and Terms
CIS 375 Bruce R. Maxim UM-Dearborn
2.1 Introduction to Object-Oriented Programming
CS 501: Software Engineering
Presentation transcript:

CS 2511 Fall 2014

UML Diagram Types  2 Main Types Structure Diagrams ○ Class Diagrams ○ Component Diagrams ○ Object Diagrams Behavior Diagrams ○ Sequence Diagrams ○ Use Case Diagrams

Class Diagrams  Type of static structure diagram  Describes: The structure of a system by showing the system’s classes The class attributes The relationships between classes

Class Node Layout Class Name Attributes of Class (Data Members) Operations of Class (Member Functions)

Example Class Diagram Revisited public class Circle { private double radius; private double area; protected double getArea(); public void setCenter(Point); public Point center; } Circle radius : double area : double center : Point getArea() : double setCenter(Point)

Visibility Specifiers  To specify the visibility of a class member (both attributes and methods) use the following before the member's name: public: + protected: # private: - package: ~

Example Class Diagram Revisited public class Circle { private double radius; private double area; protected double getArea(); public void setCenter(Point); public Point center; } Circle - radius: double - area: double + center: Point # getArea() : double + setCenter(Point)

Class Relationships  A relationship is a general term covering the specific types of logical connections found on class and object diagrams.  We’ll look at the following: Dependency Aggregation Inheritance

Dependency  A very weak relationship  A class depends on another class if it manipulates objects of the other class

UML Dependency Shape - var1 : Point + draw(Circle c) Circle - radius: double - area: double + center: Point # getArea() : double + setCenter(Point)

Dependency in Code public class Shape { public void draw(Circle c); private Point var1; // Some other variables and methods … } public class Circle { private double radius; private double area; protected double getArea(); public void setCenter(Point); public Point center; } Notice that draw(Circle c) is the only reference to class Circle in Shape, so a weak relationship

Aggregation  A class aggregates another if its objects contain objects of the other class.  The aggregate class (the class with the white diamond touching it) is in some way the “whole,” and the other class in the relationship is somehow “part” of that whole. Mailbox - messages : ArrayList Message *

Aggregation in Code public class Mailbox { private ArrayList messages; // Other Variables and Methods Go Here } public class Message { // Variables and Methods Go Here } Note that this is a 1 to many relationship since for every Mailbox there are 0 or more messages stored

Inheritance  A class inherits from another if it incorporates the behavior of the other class  Special Cases of objects of the parent class type  (Possibly) capable of exhibiting additional responsibilities

UML Inheritance Child + method2() Parent + method1() Note only methods new to Child are listed in Child class (not methods inherited from Parent)

Inheritance in Code public class Parent { public void method1(); } public class Child extends Parent { public void method2(); }

CS 2511 Fall 2014

UML Diagram Types  2 Main Types Structure Diagrams ○ Class Diagrams ○ Component Diagrams ○ Object Diagrams Behavior Diagrams ○ Sequence Diagrams ○ Use Case Diagrams

Sequence Diagrams sequence diagram  A sequence diagram in Unified Modeling Language (UML) is a kind of interaction diagram that shows how processes operate with one another and in what order. objects  In Java most of the interaction between processes is done via objects, and thus a sequence diagram basically shows how objects interact with other objects.

Organization Object Name: Class Name :Class NameObject Name Method Call

Object  Each box represents an Object that is alive (i.e. it’s constructor has been called) at a particular time in the computation.  3 options to represent objects : Object Name: Class Name :Class NameObject Name

LifeLines  The time for which an object is “alive” i.e. still in scope (which means has not been garbage collected yet) is represented by a life line. smallCircle :Circle

Activation Bars  Activation bars are used to represent the time when an object is calling a method.  The activation bars ends when the method that was called returns. smallCircle :Circle myMonitor: Display methodCall( ) Returned from method

Call Arrows and Method Names  A call is represented by an arrow going from one object to another.  Method Names are represented on the call arrow. :BridgeProblem currentState :BridgeState >

Examples  Code : public static void main(String[] args) { BridgeState initialState = new BridgeState("west", "west", "west", "west", "west", 0); BridgeState finalState = new BridgeState("east", "east", "east", "east", "east", 17); initialState.display(); finalState.display(); }

Sequence Diagram initialState: BridgeState > finalState: BridgeState > display() BridgeTest1. main