Testing Object-Oriented Software Concepts and Definitions

Slides:



Advertisements
Similar presentations
Object-Oriented Programming Python. OO Paradigm - Review Three Characteristics of OO Languages –Inheritance It isn’t necessary to build every class from.
Advertisements

1 Chapter 6: Extending classes and Inheritance. 2 Basics of Inheritance One of the basic objectives of Inheritance is code reuse If you want to extend.
CS 211 Inheritance AAA.
Georgia Institute of Technology Workshop for CS-AP Teachers Chapter 3 Advanced Object-Oriented Concepts.
Intro to OOP with Java, C. Thomas Wu Inheritance and Polymorphism
Inheritance Java permits you to use your user defined classes to create programs using inheritance.
Chapter 10: Introduction to Inheritance
ITEC200 – Week03 Inheritance and Class Hierarchies.
 In inheritance the child (subclass) chooses its parent (superclass)  Remember - only public or “protected” methods and variables are inherited  Should.
1 Inheritance Reserved word protected Reserved word super Overriding methods Class Hierarchies Reading for this lecture: L&L 8.1 – 8.5.
Inheritance and Class Hierarchies Chapter 3. Chapter 3: Inheritance and Class Hierarchies2 Chapter Objectives To understand inheritance and how it facilitates.
OOP in Java Nelson Padua-Perez Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
© 2006 Pearson Addison-Wesley. All rights reserved9 A-1 Chapter 9 Advanced Java Topics CS102 Sections 51 and 52 Marc Smith and Jim Ten Eyck Spring 2007.
OOP Week 4 1 Object Oriented Programming in Java Monday, Week 4 Last week’s asst. –rating…. This week’s asst. OOP Concepts Inheritance & Substitutability.
Chapter 7 - Generalization/Specialization and Inheritance1 Chapter 7 Generalization/Specialization and Inheritance.
C++ Object Oriented 1. Class and Object The main purpose of C++ programming is to add object orientation to the C programming language and classes are.
“is a”  Define a new class DerivedClass which extends BaseClass class BaseClass { // class contents } class DerivedClass : BaseClass { // class.
OOPs Object oriented programming. Based on ADT principles  Representation of type and operations in a single unit  Available for other units to create.
Sadegh Aliakbary Sharif University of Technology Fall 2010.
Introduction to Software Testing Chapter 7.1 Engineering Criteria for Technologies Paul Ammann & Jeff Offutt
CS200 Algorithms and Data StructuresColorado State University Part 4. Advanced Java Topics Instructor: Sangmi Pallickara
C++ Programming Basic Learning Prepared By The Smartpath Information systems
CSE 341, S. Tanimoto Java brief review - 1 Java Brief Review Java’s strengths Object-oriented terminology Inheritance Interfaces An example with inheritance.
8. Inheritance “Is-a” Relationship. Topics Creating Subclasses Overriding Methods Class Hierarchies Abstract Class Inheritance and GUIs The Timer Class.
Object-Oriented Programming Chapter Chapter
Introduction to Software Testing Chapter 7.1 Engineering Criteria for Technologies Paul Ammann & Jeff Offutt
(1) ICS 313: Programming Language Theory Chapter 12: Object Oriented Programming.
OOPs Object oriented programming. Abstract data types  Representationof type and operations in a single unit  Available for other units to create variables.
ISBN Object-Oriented Programming Chapter Chapter
C++ Inheritance Data Structures & OO Development I 1 Computer Science Dept Va Tech June 2007 © McQuain Generalization versus Abstraction Abstraction:simplify.
Java Software Solutions Lewis and Loftus Chapter 9 1 Copyright 1997 by John Lewis and William Loftus. All rights reserved. Enhanced Class Design -- Introduction.
CS 106 Introduction to Computer Science I 04 / 18 / 2008 Instructor: Michael Eckmann.
نظام المحاضرات الالكترونينظام المحاضرات الالكتروني Introduction to Object Oriented Programming (OOP) Object Oriented programming is method of programming.
JAVA INTRODUCTION. What is Java? 1. Java is a Pure Object – Oriented language 2. Java is developing by existing languages like C and C++. How Java Differs.
Inheritance and Class Hierarchies Chapter 3. Chapter 3: Inheritance and Class Hierarchies2 Chapter Objectives To understand inheritance and how it facilitates.
Java Programming, Second Edition Chapter Twelve Advanced Inheritance Concepts.
© 2007 Lawrenceville Press Slide 1 Chapter 9 Inheritance  One class is an extension of another.  Allows a class to define a specialized type of an existing.
Inheritance and Class Hierarchies Chapter 3. Chapter Objectives  To understand inheritance and how it facilitates code reuse  To understand how Java.
Chapter 11: Advanced Inheritance Concepts. Objectives Create and use abstract classes Use dynamic method binding Create arrays of subclass objects Use.
Lecture 2: Review of Object Orientation. © Lethbridge/La ganière 2005 Chapter 2: Review of Object Orientation What is Object Orientation? Procedural.
Java Software Solutions Lewis and Loftus Chapter 8 Copyright 1997 by John Lewis and William Loftus. All rights reserved. 1 Inheritance -- Introduction.
1 Enhanced Class Design Introduction zWe now examine several features of class design and organization that can improve reusability and system elegance.
 Description of Inheritance  Base Class Object  Subclass, Subtype, and Substitutability  Forms of Inheritance  Modifiers and Inheritance  The Benefits.
ISBN Chapter 12 Support for Object-Oriented Programming.
Java Programming Fifth Edition Chapter 9 Introduction to Inheritance.
Object-oriented programming (OOP) is a programming paradigm using "objects" – data structures consisting of data fields and methods together with their.
Inheritance Modern object-oriented (OO) programming languages provide 3 capabilities: encapsulation inheritance polymorphism which can improve the design,
Modern Programming Tools And Techniques-I
Paul Ammann & Jeff Offutt
Object-Oriented Design
Testing Object-Oriented Software Test Coverage Criteria
Advanced Java Topics Chapter 9
Inheritance and Polymorphism
One class is an extension of another.
Inheritance Modern object-oriented (OO) programming languages provide 3 capabilities: encapsulation inheritance polymorphism which can improve the design,
Types of Programming Languages
Object Oriented Analysis and Design
One class is an extension of another.
Understanding Inheritance
Paul Ammann & Jeff Offutt
Paul Ammann & Jeff Offutt
Advanced Java Topics Chapter 9
Java Programming, Second Edition
Inheritance.
Advanced Inheritance Concepts
Final and Abstract Classes
ENERGY 211 / CME 211 Lecture 22 November 10, 2008.
C++ Object Oriented 1.
Programming in C# CHAPTER 5 & 6
Presentation transcript:

Testing Object-Oriented Software Concepts and Definitions Jeff Offutt SWE 737 Advanced Software Testing

Inheritance Allows common features of many classes to be defined in one class A derived class has everything its parent has, plus it can: Enhance derived features (overriding) Restrict derived features Add new features (extension) The power of inheritance is its ability to utilize an existing object class and easily create a similar class with either more or less functionality without significant reimplementation. SWE 737 © Jeff Offutt

Inheritance (2) Declared type: The type given when an object reference is declared Clock w1; // declared type Clock Actual type: The type of the current object w1 = new Watch(); // actual type Watch A C B In Java, the method that is executed is the lowest version of the method defined between the actual and declared types in the inheritance hierarchy SWE 737 © Jeff Offutt

Access Control (in Java) Class 1 Package public members protected members Class 3 default private members inheritance Class 2 Class 5 Class 4 SWE 737 © Jeff Offutt

Polymorphism The same variable can have different types depending on the program execution If B inherits from A, then an object of type B can be used when an object of type A is expected If both A and B define the same method M (B overrides A), then the same statement might call either A’s version of M or B’s version SWE 737 © Jeff Offutt

Subtype and Subclass Inheritance Subtype Inheritance : If B inherits from A, any object of type B can be substituted for an object of type A A laptop “is a” special type of computer Called substitutability animal deer human Subclass Inheritance : Objects of type B may not be substituted for objects of type A Objects of B may not be “type compatible” In Java’s collection framework, a Stack inherits from a Vector … convenient for implementation, but a stack is definitely not a vector human deer This gives a deer access to “hands” ! SWE 737 © Jeff Offutt

Testing OO Software Intra-method testing : Testing individual methods within classes Inter-method testing : Multiple methods within a class are tested in concert Intra-class testing : Testing a single class, usually using sequences of calls to methods within the class Inter-class testing : More than one class is tested at the same time (integration) SWE 737 © Jeff Offutt