Object-Oriented Modeling Using UML. CS151 Chris Pollett Aug. 29, 2005.

Similar documents
Object Orientated Analysis and Design. Benjamin Kenwright

Unified Modeling Language (UML) Class Diagram

Chapter 5 Object-Oriented Programming

CHAPTER 5 GENERAL OOP CONCEPTS

OBJECT ORİENTATİON ENCAPSULATİON

Handout 7. Defining Classes part 1. Instance variables and instance methods.

Graphical Interface and Application (I3305) Semester: 1 Academic Year: 2017/2018 Dr Antoun Yaacoub

CLASSES AND OBJECTS IN JAVA

JAVA: A Primer. By: Amrita Rajagopal

CompSci 125 Lecture 07. Chapter 4: Object-Oriented Development

SEEM4570 System Design and Implementation. Lecture 11 From Design to Implementation

Defining Classes and Methods

Inheritance. Inheritance Reserved word protected Reserved word super Overriding methods Class Hierarchies Reading for this lecture: L&L

UML & OO FUNDAMENTALS CSCI 4448/5448: OBJECT-ORIENTED ANALYSIS & DESIGN LECTURE 3 08/30/2011

Chapter 2: The Object-Oriented Design Process

Paytm Programming Sample paper: 1) A copy constructor is called. a. when an object is returned by value

UML & OO Fundamentals. CSCI 4448/5448: Object-Oriented Analysis & Design Lecture 3 09/04/2012

The Unified Modeling Language. Asst.Prof.Dr. Supakit Nootyaskool IT-KMITL

Program Abstractions, Language Paradigms. CS152. Chris Pollett. Aug. 27, 2008.

Learning Objectives. C++ For Artists 2003 Rick Miller All Rights Reserved xli

CS1004: Intro to CS in Java, Spring 2005

The major elements of the object-oriented model

Inheritance and Polymorphism

Object Oriented Features. Inheritance. Inheritance. CS257 Computer Science I Kevin Sahr, PhD. Lecture 10: Inheritance

Index. Index. More information. block statements 66 y 107 Boolean 107 break 55, 68 built-in types 107


CmSc 150 Fundamentals of Computing I. Lesson 28: Introduction to Classes and Objects in Java. 1. Classes and Objects

Object Fundamentals. Kenneth M. Anderson University of Colorado, Boulder CSCI 4448/6448 Lecture 2 08/30/2007

Programming Exercise 14: Inheritance and Polymorphism


Chapter 7. Inheritance

Programming II (CS300)

SHRI ANGALAMMAN COLLEGE OF ENGINEERING & TECHNOLOGY (An ISO 9001:2008 Certified Institution) SIRUGANOOR,TRICHY

Principles of Software Design. Software Engineering Alessio Gambi Saarland University

COURSE 2 DESIGN PATTERNS

Programming I. Course 9 Introduction to programming

The Object Oriented Paradigm

Chapter 9 Objects and Classes. Liang, Introduction to C++ Programming, (c) 2007 Pearson Education, Inc. All rights reserved.

Subclass Gist Example: Chess Super Keyword Shadowing Overriding Why? L10 - Polymorphism and Abstract Classes The Four Principles of Object Oriented

Programming Languages and Techniques (CIS120)

Computer Science II. OO Programming Classes Scott C Johnson Rochester Institute of Technology

What are the characteristics of Object Oriented programming language?

The Essence of Object Oriented Programming with Java and UML. Chapter 2. The Essence of Objects. What Is an Object-Oriented System?

Chapter 10 Object-Oriented Design Principles

Inheritance (cont.) Inheritance. Hierarchy of Classes. Inheritance (cont.)

ECE 122. Engineering Problem Solving with Java

Elementary Concepts of Object Class

INHERITANCE & POLYMORPHISM. INTRODUCTION IB DP Computer science Standard Level ICS3U. INTRODUCTION IB DP Computer science Standard Level ICS3U

1. Software Systems Complexity, OO Paradigm, UML

Object-Oriented Design

Chapter 4 Defining Classes I

Weiss Chapter 1 terminology (parenthesized numbers are page numbers)

ECOM 2324 COMPUTER PROGRAMMING II

Java. Classes 3/3/2014. Summary: Chapters 1 to 10. Java (2)

Object-Oriented Analysis, Design and Implementation. Case Study Part II

Practice for Chapter 11

Programming II (CS300)

Agenda. Objects and classes Encapsulation and information hiding Documentation Packages

More on Inheritance. Interfaces & Abstract Classes

Lecture Notes on Programming Languages

The Challenge. Principles of Software Design

OVERRIDING. 7/11/2015 Budditha Hettige 82

Introduction to Object-Oriented Programming

Object-Oriented Programming

CSE Lecture 3: Objects 2 September Nate Nystrom University of Texas at Arlington

Zhifu Pei CSCI5448 Spring 2011 Prof. Kenneth M. Anderson

Package. A package is a set of related classes Syntax to put a class into a package: Two rules: Example:

Components vs. Objects

Chapter 6 Introduction to Defining Classes

ENCAPSULATION AND POLYMORPHISM

administrivia today UML start design patterns Tuesday, September 28, 2010

Objects First with Java A Practical Introduction using BlueJ

Computer Science 2 Lecture 4 Inheritance: Trinidad Fruit Stand 02/15/2014 Revision : 1.7

Chapter 3 Objects and Classes

Classes. Logical method to organise data and functions in a same structure. Also known as abstract data type (ADT).

Announcement. Agenda 7/31/2008. Polymorphism, Dynamic Binding and Interface. The class will continue on Tuesday, 12 th August

UML IB Computer Science. Content developed by Dartford Grammar School Computer Science Department

OOPs Concepts. 1. Data Hiding 2. Encapsulation 3. Abstraction 4. Is-A Relationship 5. Method Signature 6. Polymorphism 7. Constructors 8.

Chapter 2 Object Orientation. Software Architecture Object Orientation 1

Accessibility. EEC 521: Software Engineering. Classes and Objects. Inheritance. Classes and Objects (OO Analysis)

Introduction to OO Concepts

Object-Oriented Design

CS111: PROGRAMMING LANGUAGE II. Lecture 1: Introduction to classes

COMP 250 Winter 2011 Reading: Java background January 5, 2011

A - 1. CS 494 Object-Oriented Analysis & Design. UML Class Models. Overview. Class Model Perspectives (cont d) Developing Class Models

c) And last but not least, there are javadoc comments. See Weiss.

Information System Design (IT60105)

CS 520 Theory and Practice of Software Engineering Fall 2018

Inheritance and Polymorphism

Lecturer: Sebastian Coope Ashton Building, Room G.18 COMP 201 web-page:

Software Architecture and Design I

Inheritance and Polymorphism


Lecture 6 Introduction to Objects and Classes

Classes. Classes. Classes. Class Circle with methods. Class Circle with fields. Classes and Objects in Java. Introduce to classes and objects in Java.

Comments are almost like C++

C++ Important Questions with Answers

Contents. I. Classes, Superclasses, and Subclasses. Topic 04 - Inheritance

Object-Oriented Programming Concepts

The return Statement

Transcription:

Object-Oriented Modeling Using UML CS151 Chris Pollett Aug. 29, 2005.

Outline Objects and Classes Modeling Relationships and Structures

Some Terms and Concepts Objects and classes are fundamental to OO development. They both can be viewed from a real world perspective and from within the OO-model. Interpretation in Real World Representation in the Model Object Class An object represents anything in the real world that can be distinctly identified A class represents a set of objects with similar characteristics and behaviors. An object has an identity, a state and a behavior. A class characterizes the structure of states and behaviors that are shared by all objects

More Terms and Concepts An identity distinguishes one object from another. An object (aka instance) consists of a set of fields (aka attributes). Each field has a type and a value. These give the object a state The behavior of on an object is defined by a set of methods (aka member functions/operations) that may operate on it. State + Methods = Features

Still More Concepts Two objects are equal if their states are equal. Two objects are identical if they are the same object. Accessors are methods which do not modify the state of an object. Mutators are methods which do modify the state of an object. An object is mutable/immutable depending on whether its state can be changed. An example class: class Point { int x, y; //fields public void move(int dx, int dy) {/*implementation*/} // Method }

UML Unified Modeling Language Used during the design phase We will use this language to model different kinds of OO software project Given a UML diagram we can then proceed to actually implement it in some language like Java

UML Notations for Classe omittable ClassName field1 field2 fieldn method1 method2 methodn Fields can either be in the form: [Visibility][Type]Name[[Multiplicity]] [= Value] Ex. int a or [Visibility]Name [[Multiplicity]] : Type [= Value] Ex. a: int Methods can either be in the form: [Visibility][Type] Name ([Param], ) Ex.private int getday (Date d) or [Visibility] Name ([Param], ) :Type Ex. -getdate(d:date) :int

More on Visibility Visibility Java Syntax UML Syntax Meaning public protected package public protected + # ~ any class can see same package and subclasses can see package can see private private - class only can see

UML Notation for Objects objname:classname field1 = value1. fieldn = valuen For example, p:point x=20 y=15 omittable

Message Passing Objects communicate with each other by means of message passing. A message represents a command sent to an object -- known as the recipient of the command -- to perform an action (invoke one of its methods). A message consists of a receiving object, a method to invoke, and any arguments for this method. p1.move(10,20); /* recipient is p1, method is move, arguments are (10,20) */

UML Notations of Packages Classes are often grouped together into packages. We ll follow the convention that packages should have all lower case names. Ex edu.sjsu.cs.pollett Using internet domains (convention in reverse order) ensures packages names will be unique. UML looks like: java.awt event Point java.lang

OO Principles Modularity -- a complex software system should be decomposed into a set of highly cohesive but loosely couple modules Abstraction -- functionalities of a module should be characterized in a succinct and precise description known as a contractual interface. Encapsulation - implementation of a module should be separated from the contractual interface and hidden from the module user Polymorphism - different service providers can implement the same contractual interface

Modeling Relationships A UML class diagram consists of a set of nodes to represents classes or interfaces and a set of links to represent relationships between these classes. Possible relationships: Inheritance -- includes extension and implementation Association -- includes aggregation and composition Dependency

UML Notation for Inheritance Superclass SuperInterface Interface Subclass Extension of a class SubInterface Extension of an interface Implementation Implementation of an interface

Levels of Abstraction Abstraction can be ordered into more than two levels. The higher the level the more general the abstraction A B D C