The Basics of Class Diagrams for a single class

Slides:



Advertisements
Similar presentations
Introduction to Object Orientation System Analysis and Design
Advertisements

7M701 1 Information Systems Modelling and Design with.
Introduction to Object-Oriented Programming CS 21a: Introduction to Computing I First Semester,
CS3773 Software Engineering Lecture 03 UML Use Cases.
Using Diagrams to Represent Program Structure OMT and UML Some pictures and material are from “Design Patterns” by Gamma et al.
1 Software Testing and Quality Assurance Lecture 12 - The Testing Perspective (Chapter 2, A Practical Guide to Testing Object-Oriented Software)
Designing Classes Chapter 3. 2 Chapter Contents Encapsulation Specifying Methods Java Interfaces Writing an Interface Implementing an Interface An Interface.
Kari R. Schougaard, PhD Stud. Værktøjer og Teknikker, 2006 UNIVERSITY OF AARHUS Department of Computer Science Unified Modeling Language Visual language.
Chapter 9: Classes with Instance Variables or Classes=Methods+Variables Asserting Java © Rick Mercer.
CS 2511 Fall UML Diagram Types  2 Main Types Structure Diagrams ○ Class Diagrams ○ Component Diagrams ○ Object Diagrams Behavior Diagrams ○ Sequence.
ACM/JETT Workshop - August 4-5, 2005 UML Modeling using MagicDraw UML for Java Programmers.
Chapter 10: Inheritance 1. Inheritance  Inheritance allows a software developer to derive a new class from an existing one  The existing class is called.
CS 2511 Fall UML Diagram Types  2 Main Types Structure Diagrams ○ Class Diagrams ○ Component Diagrams ○ Object Diagrams Behavior Diagrams ○
Programming Languages and Paradigms Object-Oriented Programming.
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.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter Chapter 1 Introduction to Object-Oriented Programming and.
Introduction to Java Class Diagrams. Classes class Account { … } Account.
Object-Oriented Analysis and Design An Introduction.
UML Review – class diagrams SE 2030 Dr. Rob Hasker 1 Based on slides written by Dr. Mark L. Hornick Used with permission.
ACO 101: Introduction to Computer Science Anatomy Part 2: Methods.
Object-Oriented Software Engineering Practical Software Development using UML and Java Chapter 5: Modelling with Classes.
1 Forward and Reverse Engineering. 2 The UML is not just an OO modeling language. It also permits forward engineering (FE) and reverse engineering (RE).
CS-2852 Data Structures LECTURE 3B Andrew J. Wozniewicz Image copyright © 2010 andyjphoto.com.
UML Diagrams A tool for presentation of Architecture.
Introduction to Unified Modeling Language (UML) By Rick Mercer with help from The Unified Modeling Language User Guide, Grady Booch, James Rumbaugh, Ivar.
1 Introduction to Classes and Objects Chapter 3 Introduction to Classes and Objects Chapter 3.
 28object-oriented_programming%29 28object-oriented_programming%29.
BCS 2143 Object Oriented Design Using UML. Objectives Objects Interactions Finding Classes Relationship Between Classes Attribute and Operation Class.
Designing Classes Chapter 3. 2 Chapter Contents Encapsulation Specifying Methods Java Interfaces Writing an Interface Implementing an Interface An Interface.
Session 02 and 03: C# OOP 1 OOP in C#: Classes and Objects in C#. Object-Oriented Design. UML Class Diagram. Object Interaction. FEN AK IT:
ACO 101: Intro to Computer Science Anatomy Part 3: The Constructor.
ACM/JETT Workshop - August 4-5, : Defining Classes in Java.
©2007 · Georges Merx and Ronald J. NormanSlide 1 Chapter 15 The Unified Modeling Language: a Primer.
Lecture 9-1 : Intro. to UML (Unified Modeling Language)
Practical Object-Oriented Design with UML 2e Slide 1/1 ©The McGraw-Hill Companies, 2004 PRACTICAL OBJECT-ORIENTED DESIGN WITH UML 2e Chapter 1: Introduction.
Problem 1 Bank.  Manage customers’ bank account using the following operations: Create a new account given a customer’s name and initial account. Deposit.
TK2023 Object-Oriented Software Engineering CHAPTER 9 INTRODUCTION TO OBJECT DESIGN.
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 2: Introduction to Object Orientation Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph S. Valacich, Jeffrey A.
Inheritance and Subclasses CS 21a. 6/28/2004 Copyright 2004, by the authors of these slides, and Ateneo de Manila University. All rights reserved L16:
Object-Oriented Software Engineering Practical Software Development using UML and Java Modelling with Classes.
CS 116 OBJECT ORIENTED PROGRAMMING II LECTURE 6 Acknowledgement: Contains materials provided by George Koutsogiannakis and Matt Bauer.
UML. Model An abstract representation of a system. Types of model 1.Use case model 2.Domain model 3.Analysis object model 4.Implementation model 5.Test.
Introduction to Unified Modeling Language (UML) By Rick Mercer with help from The Unified Modeling Language User Guide, Grady Booch, James Rumbaugh, Ivar.
Designing Classes Lab. The object that you brought to class Put it in the basket we will exchange them now.
UML Review – class diagrams SE-2030 Dr. Mark L. Hornick 1.
Modeling with UML – Class Diagrams
Unified Modeling Language (UML)
UML - Class Diagrams.
Introduction to Unified Modeling Language (UML)
Introduction to Unified Modeling Language (UML)
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
Software Engineering System Modeling Chapter 5 (Part 2) Dr.Doaa Sami
Class Diagram Details CS 124.
A tool for presentation of Architecture
A tool for presentation of Architecture
CLASS DEFINITION (> 1 CONSTRUCTOR)
Introduction to Unified Modeling Language (UML)
CSC 205 Java Programming II
Showing Relationships in UML
ניתוח מערכות מידע א' הרצאה 3
Introduction to Unified Modeling Language (UML)
INFS 6225 Object Oriented Systems Analysis & Design
Unified Modelling Language
Software Engineering System Modeling Extra examples Dr.Doaa Sami
Using Diagrams to Represent Program Structure
By Rajanikanth B OOP Concepts By Rajanikanth B
Sample Test Questions Please identify the use cases of the system that cover all the behaviors described in the system specification. Please identify.
The Unified Modeling Language
The Unified Modeling Language
Presentation transcript:

The Basics of Class Diagrams for a single class UML Class Diagram The Basics of Class Diagrams for a single class

Unified Modeling Language A standard notation for describing software models and code Unifies the notation of Booch, OMT (Rumbaugh et al), and OOSE (Jacobson et al)

Many Kinds of UML Diagrams UML has 20+ different kinds of diagrams. Each diagram shows a different kind of information (or different view) of application. Class diagram Sequence diagram State Machine diagram (aka State Chart Diagram) Object diagram Interaction diagram Activity diagram Package Diagram many others! These 3 are the most common and most important to know.

Class Diagram A class diagram shows the structure of a class It can also show relationships between classes Here is the simplest possible class diagram: BankAccount

Class Diagrams methods & attributes BankAccount deposit( amount ) withdraw( amount ) getBalance( ) BankAccount balance owner id deposit( amount ) withdraw( amount ) getBalance( )

Class Diagram with data types Class diagram can show data types & visibility Not Java notation ("double balance") BankAccount -balance: double +deposit(amt: double): void +withdraw(amt: double): boolean +getBalance( ): double

Visibility of Members balance is private (visible only within BankAccount objects) deposit, withdraw, getBalance are public BankAccount - balance: double + deposit( amount: double ) + withdraw( amount: double ) + getBalance( ): double

Visibility Prefixes + means public Visible everywhere – means private Visible only in the class in which it is defined # means protected Visible either within the class in which it is defined or within subclasses of that class ~ means package visibility visible to other classes in the same package

Constructors -balance: double -balance: double BankAccount -balance: double <<constructor>> +BankAccount( owner ) +deposit(amount) . . . BankAccount -balance: double +BankAccount( owner ) +deposit(amount) . . .

Static Members private static attribute Use underscore to show static attributes or methods. Example: BankAccount class has a static nextAccountId attribute. BankAccount -nextAccountId: long -balance: double -id: long +BankAccount( owner ) +getBalance( ): double . . . private static attribute

Practice: Draw UML of class

Showing Multiplicity in UML A Course has zero or more students. public class Course { private Student[] students; Course -students: Student[*] A deck of cards has exactly 52 cards. public class CardDeck { private Card[] cards = new Card[52]; CardDeck -cards: Card[52]

A Single Class Draw a UML class diagram of this class. public class Student { public static String idPattern = "[1-9]\\d{9}"; private long id; protected String name; public String getName( ) { . . . } public void setName(String aname) { . . . }

A Single Class Draw a UML class diagram of this class.

Reference UML Distilled, 3rd Edition. Chapter 3 & 5 cover UML class diagrams.