Objects and Classes Abstract Classes and Interface Sanjaya Karunasena

Slides:



Advertisements
Similar presentations
UML: The Unified Modeling Language Excertos do livro: The Unified Modelling Language User Guide by Grady Booch, James Rumbaugh and Ivar Jacobson.
Advertisements

UML (cont.) “The Unified Modeling Language User Guide” by G. Booch, J. Rumbaugh and I. Jacobson ● Classes ● Relationships ● Class diagrams ● Examples.
Reusable Classes.  Motivation: Write less code!
ESE Einführung in Software Engineering 6. Modeling Objects and Classes Prof. O. Nierstrasz.
A Brief Introduction. Acknowledgements  The material in this tutorial is based in part on: Concurrency: State Models & Java Programming, by Jeff Magee.
Inheritance Java permits you to use your user defined classes to create programs using inheritance.
SE-1020 Dr. Mark L. Hornick 1 Inheritance and Polymorphism: Abstract Classes The “not quite” classes.
CS 106 Introduction to Computer Science I 11 / 26 / 2007 Instructor: Michael Eckmann.
Chapter 1 Object-Oriented System Development
1 Software Testing and Quality Assurance Lecture 12 - The Testing Perspective (Chapter 2, A Practical Guide to Testing Object-Oriented Software)
CSE 115 Week 10 March , Announcements March 21 – Lab 7 Q & A in lecture March 21 – Lab 7 Q & A in lecture March 26 – Exam 7 March 26 – Exam.
CS 106 Introduction to Computer Science I 11 / 28 / 2007 Instructor: Michael Eckmann.
Slide 1 Systems Analysis & Design CS183 Spring Semester 2008 Dr. Jonathan Y. Clark Course Website:
Principles of Object-Oriented Software Development Unified Modeling Language.
7M822 UML Class Diagrams advanced concepts 15 September 2008.
7M822 UML Class Diagrams advanced concepts 14 October 2010.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter N - 1 Chapter 13 Polymorphism is-a relationships Interfaces.
8.1 Classes & Inheritance Inheritance Objects are created to model ‘things’ Sometimes, ‘things’ may be different, but still have many attributes.
Classes in C++ Bryce Boe 2012/08/15 CS32, Summer 2012 B.
Unified Modeling Language(UML) BY
The Unified Modeling Language (UML) Class Diagrams.
CSCI-383 Object-Oriented Programming & Design Lecture 9.
CIT UPES | Sept 2013 | Unified Modeling Language - UML.
The Software Development Life Cycle: An Overview Presented by Maxwell Drew and Dan Kaiser Southwest State University Computer Science Program.
Object Oriented Design and Programming Alan Goude Room: Sheaf 9323.
Slide 1 UML Review Chapter 2: Introduction to Object-Oriented Systems Analysis and Design with the Unified Modeling Language, Version 2.0 Alan Dennis,
Unified Modeling Language, Version 2.0
CS-2852 Data Structures LECTURE 3B Andrew J. Wozniewicz Image copyright © 2010 andyjphoto.com.
UML: The Unified Modeling Language Excertos do livro: The Unified Modelling Language User Guide by Grady Booch, James Rumbaugh and Ivar Jacobson.
Slide 1 Systems Analysis and Design With UML 2.0 An Object-Oriented Approach, Second Edition Chapter 2: Introduction to Object-Oriented Systems Analysis.
Unified Modeling Language. Object Oriented Methods ► What are object-oriented (OO) methods?  OO methods provide a set of techniques for analyzing, decomposing,
CSE 403, Spring 2008, Alverson Using UML to express Software Architecture.
CSE 403, Spring 2007, Alverson Using UML to express Software Architecture.
Information Systems Analysis and Design Lesson Plan Ismiarta Aknuranda PTIIK UB Spring Semester
UML Diagrams for Caradon developers Daniel DG Moth Core Development Group, Research Student University of Brighton, MSc Object Oriented Software Technology.
HIGH-LEVEL Language Revision Guide By Tom. Declarative programming The computer is given a set of facts......And a Goal This finds all members with 2G.
Slide 1 Systems Analysis and Design With UML 2.0 An Object-Oriented Approach, Second Edition Chapter 2: Introduction to Object-Oriented Systems Analysis.
MADALINA CROITORU Software Engineering week 4 Practical Madalina Croitoru IUT Montpellier.
1 Unified Modeling Language, Version 2.0 Chapter 2.
Chapter 2: Introduction to Object Orientation Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph S. Valacich, Jeffrey A.
Unified OO becomes commonly used in the late 1980s Various analysis and design methods The “three amigos” join forces in Rational Software Also include.
CS 210 Introduction to OO Design August 24, 2006
Slide 1 Objectives Understand the basic characteristics of object-oriented systems. Be familiar with the Unified Modeling Language (UML),V.2.0.
Unified Process Software Development Darren Roback/Ravali Kallem CMIS Fall 2009.
Inheritance & Method Overriding BCIS 3680 Enterprise Programming.
Basic Characteristics of Object-Oriented Systems
Distributed Java Programming Distributed Java Programming Class #1 August 20, 2002.
Chapter 11 Inheritance © 2008 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved. Marilyn Bohl/Maria Rynn Tools for Structured and Object-Oriented.
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.
SUBCLASSES - JAVA. The Purpose of Subclasses Class Farm String getOwner() void setOwner(String s) int getSize() void setSize(int s) Class DairyFarm String.
1 An Overview of UML. 2 The Unified Modeling Language UML is a graphical language used by software engineers to model software systems during development.
Slide 1 Unified Modeling Language, Version 2.0 Object-Oriented SAD.
Identifying Object Relationships, Attributes, and Methods.
Embedded Systems Software Engineering
Modeling with UML – Class Diagrams
Modern Programming Tools And Techniques-I
Unified Modeling Language (UML)
Object-oriented and Structured System Models
Business System Development
Evolution of UML.
Object-Oriented Modeling with UML
Systems Analysis and Design With UML 2
Systems Analysis and Design With UML 2
Object-Oriented Programming & Design Lecture 18 Martin van Bommel
James Miller, Julia John
University of Central Florida COP 3330 Object Oriented Programming
Domain Class Diagram Chapter 4 Part 2 pp
Introduction to UML.
Advanced Programming Behnam Hatami Fall 2017.
Mapping UML to RDB, J.P.Nytun – page 1
Presentation transcript:

Objects and Classes Abstract Classes and Interface Sanjaya Karunasena

Outline Abstract Classes and abstract methods Interface Classes

Abstract Classes Some times in a inheritance hierarchy, having a instance of a super (parent) class does not make sense Instance of the class Pet does not make sense when there are sub classes like, Dog, Cat, etc. However we still need the super class to have generalization We can achieve this by making the super class abstract Instance of an abstract class cannot be created Abstract class can be used to enforce some behavior to the sub class This is achieved by declaring abstract methods

Abstract Classes cont. An abstract method doesn’t have an implementation Sub classes have to implement the parent’s abstract methods In most of the programming languages if a class to be abstract it need to have at least one abstract method Pet CatDog + Talk()

Abstract Classes cont.

Interface Classes Some times we would like to enforce some behavior across unrelated classes In other words classes may have similar behavior even though they don’t belong to the same parent We can enforce such behavior by making use of an interface class Interface class can only have abstract methods It can have attributes To obtain the behavior defined by an interface, a class has to implement the interface class

Interface Classes cont. There could be generalization within interfaces A class can implement multiple interfaces When unrelated classes implement the same interface they will have some sort of similar behavior even though they are not related at all

Interface Classes cont. CatDogCar VehiclePet Lorry IRace_able

Interface Classes cont.

References The Unified Modeling Language User Guide – Grady Booch, James Rumbaugh, Ivar Jacobson UML™2 Bible – Tom Pender