COMP 3705 Advanced Software Engineering: Software Testing

Size: px
Start display at page:

Download "COMP 3705 Advanced Software Engineering: Software Testing"

Transcription

1 COMP 3705 Advanced Software Engineering: Software Testing Prof. Matt Rutherford Class (c) 2009 Matthew J. Rutherford For Next Week Readings Chapters 7 and 9 Homework #8 See website Class (c) 2009 Matthew J. Rutherford 1

2 Final Exam In two weeks First hour will be review / summary Exam will be the last 2 hours Open book / notes Comprehensive Mix of short answers (a paragraph) and problems to work Class (c) 2009 Matthew J. Rutherford Today Finish up Mutation Testing Chapter 6: Regression testing Integration testing Process / Test plans Oracles Class (c) 2009 Matthew J. Rutherford 2

3 Midterm Exam Excellent Job! Median / Average: 90% Std. Deviation: 5% Class (c) 2009 Matthew J. Rutherford Testing Programs with Mutation Prog Input test method Create mutants Run equivalence detector Generate test cases Run T on P Define threshold no Run mutants: schema-based weak selective Threshold reached? Eliminate ineffective TCs Fix P no P (T) correct? yes Ammann & Offutt 3

4 Homework #7 Class (c) 2009 Matthew J. Rutherford Why Mutation Works This is not an absolute! The mutants guide the tester to a very effective set of tests A very challenging problem : Find a fault and a set of mutation-adequate tests that do not find the fault Of course, this depends on the mutation operators Ammann & Offutt 4

5 Exercise Collaborate with those in your row to come up with the sneakiest bug you can We ll add the bug as a mutant and see if a mutationadequate test finds it Class (c) 2009 Matthew J. Rutherford Designing Mutation Operators At the method level, mutation operators for different programming languages are similar Mutation operators do one of two things: Mimic typical programmer mistakes ( incorrect variable name ) Encourage common test heuristics ( cause expressions to be 0 ) Researchers design lots of operators, then experimentally select the most useful 5

6 Subsumption of Other Criteria Mutation is widely considered the strongest test criterion And most expensive! Mutation subsumes other criteria by including specific mutation operators Subsumption actually only makes sense for weak mutation other criteria impose local requirements, like weak mutation Node coverage Edge coverage Clause coverage General active clause coverage Correlated active clause coverage All-defs data flow coverage Integration and Object-Oriented Testing In Java, testing the way classes, packages and components are connected Component is used as a generic term This tests features that are unique to object-oriented programming languages inheritance, polymorphism and dynamic binding Integration testing is often based on couplings the explicit and implicit relationships among software components 6

7 Integration Mutation (5.3.2) Faults related to component integration often depend on a mismatch of assumptions Callee thought a list was sorted, caller did not Callee thought all fields were initialized, caller only initialized some of the fields Caller sent values in kilometers, callee thought they were miles Integration mutation focuses on mutating the connections between components Sometimes called interface mutation Both caller and callee methods are considered Four Types of Mutation Operators Change a calling method by modifying values that are sent to a called method Change a calling method by modifying the call Change a called method by modifying values that enter and leave a method Includes parameters as well as variables from higher scopes (class level, package, public, etc.) Change a called method by modifying return statements from the method 7

8 Five Integration Mutation Operators 1. IPVR Integration Parameter Variable Replacement Each parameter in a method call is replaced by each other variable in the scope of the method call that is of compatible type. This operator replaces primitive type variables as well as objects. 2. IUOI Integration Unary Operator Insertion Each expression in a method call is modified by inserting all possible unary operators in front and behind it. The unary operators vary by language and type 3. IPEX Integration Parameter Exchange Each parameter in a method call is exchanged with each parameter of compatible types in that method call. max (a, b) is mutated to max (b, a) Five Integration Mutation Operators (2) 4. IMCD Integration Method Call Deletion Each method call is deleted. If the method returns a value and it is used in an expression, the method call is replaced with an appropriate constant value. Method calls that return objects are replaced with calls to new () 5. IREM Integration Return Expression Modification Each expression in each return statement in a method is modified by applying the UOI and AOR operators. UOR Unary Operator Insertion (add: +, -,! and ~) AOR Arithmetic Operator Replacement (+, -, *, /,**, and %) 8

9 Integration Mutation Operators Example 1. IPVR Integration Parameter Variable Replacement 2. IUOI Integration Unary Operator Insertion MyObject a, b;... callmethod (a); Δ callmethod (b); callmethod (a); Δ callmethod (a++); Integration Mutation Operators Example 3. IPEX Integration Parameter Exchange Max (a, b); Δ Max (b, a); 4. IMCD Integration Method Call Deletion X = Max (a, b); Δ X = new Integer (3); 5. IREM Integration Return Expression Modification int mymethod () { return a; Δ return ++a; } 9

10 Object-Oriented Mutation integration mutation operators These five operators can be applied to non-oo languages C, Pascal, Ada, Fortran, They do not support object oriented features Inheritance, polymorphism, dynamic binding Two other language features that are often lumped with OO features are information hiding (encapsulation) and overloading Even experienced programmers often get encapsulation and access control wrong Object-Oriented Language Features (Java) Method overriding Allows a method in a subclass to have the same name, arguments and result type as a method in its parent Variable hiding Achieved by defining a variable in a child class that has the same name and type of an inherited variable Class constructors Not inherited in the same way other methods are must be explicitly called Each object has a declared type : Parent P; an actual type : P = new Child (); or assignment : P = Pold; Declared and actual types allow uses of the same name to reference different variables with different types 10

11 OO Language Feature Terms Polymorphic attribute An object reference that can take on various types Type the object reference takes on during execution can change Polymorphic method Can accept parameters of different types because it has a parameter that is declared of type Object Overloading Using the same name for different constructors or methods in the same class Overriding A child class declares an object or method with a name that is already declared in an ancestor class Easily confused with overloading because the two mechanisms have similar names and semantics Overloading is in the same class, overriding is between a class and a descendant More OO Language Feature Terms Members associated with a class are called class or instance variables and methods Static methods can operate only on static variables; not instance variables Instance variables are declared at the class level and are available to objects 20 object-oriented mutation operators defined for Java mujava Broken into 4 general categories 11

12 Class Mutation Operators for Java (1) Encapsulation AMC (2) Inheritance HVD, HVI, OMD, OMM, OMR, SKD, PCD (3) Polymorphism ATC, DTC, PTC, RTC, OMC, OMD, AOC, ANC (4) Java-Specific TKD, SMC, VID, DCD OO Mutation Operators Inheritance 2. HVD Hiding Variable Deletion Each declaration of an overriding or hiding variable is deleted. 3. HVI Hiding Variable Insertion A declaration is added to hide the declaration of each variable declared in an ancestor. 4. OMD Overriding Method Deletion Each entire declaration of an overriding method is deleted. 5. OMM Overridden Method Moving Each call to an overridden method is moved to the first and last statements of the method and up and down one statement. 12

13 OO Mutation Operators Example 2. HVD Hiding Variable Deletion 3. HVI Hiding Variable Insertion point int x; int y; point int x; int y; colorpoint int x; Δ1 // int x; int y; Δ2 // int y; colorpoint Δ1 int x; Δ2 int y; OO Mutation Operators Example 4. OMD Overriding Method Deletion 5. OMM Overriding Method Moving point void set (int x, int y) colorpoint void set (int x, int y) Δ // void set (int x, int y) point void set (int x, int y) { width = 5; } colorpoint void set (int x, int y) { super.set (x, y); width = 10;} Δ { width=10; super.set (x, y); } 13

14 OO Mutation Operators Inheritance 6. OMR Overridden Method Rename Renames the parent s versions of methods that are overridden in a subclass so that the overriding does not affect the parent s method. 7. SKD Super Keyword Deletion Delete each occurrence of the super keyword. 8. PCD Parent Constructor Deletion Each call to a super constructor is deleted. OO Mutation Operators Example 6. OMR Overriding Method Rename point void set (int x, int y) Δ void setp (int x, int y) void setdimension (int d) { set (x, y); Δ setp (x, y); } point p; p = new colorpoint (); p.set (1, 2); p.setdimension (3); 7. SKD Super Keyword Deletion point int getx() colorpoint int getx () { return super.x; Δ return x; } colorpoint void set (int x, int y) 14

15 OO Mutation Operators Example 8. PCD Parent Constructor Deletion point point (int x, int y) colorpoint colorpoint (int x, int y, int color) { super (x, y); Δ // super (x, y); } OO Mutation Operators Language Specific 17. TKD this Keyword Deletion Each occurrence of the keyword this is deleted. 18. SMC Static Modifier Change Each instance of the static modifier is removed, and the static modifier is added to instance variables. 19. VID Variable Initialization Deletion Remove initialization of each member variable. 20. DCD Default Constructor Delete Delete each declaration of default constructor (with no parameters). 15

16 OO Mutation Operators Example 17. JTD This Keyword Deletion 18. JSD Static Modifier Change point void set (int x, int y) { this.x = x; Δ1 x = x; this.y = y; Δ2 y = y; } point public static int x = 0; Δ 1 public int x = 0; public int Y = 0; Δ2 public static int y = 0; OO Mutation Operators Example 19. VID Variable Initialization Deletion 20. DCD Default Constructor Delete point int x = 0; Δ int x; point point() { } Δ // point() { } 16

17 Integration Mutation Summary Integration testing often looks at couplings We have not used grammar testing at the integration level Mutation testing modifies callers and callees OO mutation focuses on inheritance, polymorphism, dynamic binding, information hiding and overloading The access levels make it easy to make mistakes in OO software mujava is an educational / research tool for mutation testing of Java programs Chapter 6: Practical Issues Regression Testing Integration Testing Process Test Plans Oracles Class (c) 2009 Matthew J. Rutherford 17

18 The Toolbox Chapters 1-5 fill up a toolbox with useful criteria for testing software To move to level 3 (reducing risk) or level 4 (mental discipline of quality), testing must be integrated into the development process Most importantly : In any activity, knowing the tools is only the first step The key is utilizing the tools in effective ways Topics : Integrating software components and testing Integrating testing with development Test plans Checking the output Introduction to Software Testing (Ch 6), Regression Testing (6.1) Most software today has very little new development Correcting, perfecting, adapting, or preventing problems with existing software Composing new programs from existing components Applying existing software to new situations Because of the deep interconnections among software components, changes in one method can cause problems in methods that seem to be unrelated Not surprisingly, most of our testing effort is regression testing Large regression test suites accumulate as programs (and software components) age Introduction to Software Testing (Ch 6), 18

19 Automation and Tool Support Too many tests to be run by hand Tests must be run and evaluated quickly often overnight, or more frequently for web applications Testers do not have time to view the results by inspection Types of tools : Capture / Replay Capture values entered into a GUI and replay those values on new versions Version control Keeps track of collections of tests, expected results, where the tests came from, the criterion used, and their past effectiveness Scripting software Manages the process of obtaining test inputs, executing the software, obtaining the outputs, comparing the results, and generating test reports Tools are plentiful and inexpensive (often free) Introduction to Software Testing (Ch 6), Managing Tests in a Regression Suite Test suites accumulate new tests over time Test suites are usually run in a fixed, short, period of time Often overnight, sometimes more frequently, sometimes less At some point, the number of tests can become unmanageable We cannot finish running the tests in the time allotted We can always add more computer hardware But is it worth it? How many of these tests really need to be run? Introduction to Software Testing (Ch 6), Ammann & Offutt 38 19

20 Policies for Updating Test Suites Which tests to keep can be based on several policies Add a new test for every problem report Ensure that a coverage criterion is always satisfied Sometimes harder to choose tests to remove Remove tests that do not contribute to satisfying coverage Remove tests that have never found a fault (risky!) Remove tests that have found the same fault as other tests (also risky!) Reordering strategies If a suite of N tests satisfies a coverage criterion, the tests can often be reordered so that the first N-x tests satisfies the criterion so the remaining tests can be removed Introduction to Software Testing (Ch 6), Ammann & Offutt 39 When a Regression Test Fails Regression tests are evaluated based on whether the result on the new program P is equivalent to the result on the previous version P-1 If they differ, the test is considered to have failed Regression test failures represent three possibilities : The software has a fault Must fix the fix The test values are no longer valid on the new version Must delete or modify the test The expected output is no longer valid Must update the test Sometimes hard to decide which!! Introduction to Software Testing (Ch 6), Ammann & Offutt 40 20

21 Evolving Tests Over Time Changes to external interfaces can sometimes cause all tests to fail Modern capture / replay tools will not be fooled by trivial changes like color, format, and placement Automated scripts can be changed automatically via global changes in an editor or by another script Adding one test does not cost much but over time the cost of these small additions start to pile up Introduction to Software Testing (Ch 6), Ammann & Offutt 41 Choosing Which Regression Tests to Run When a small change is made in the software, what portions of the software can be impacted by that change? More directly, which tests need to be re-run? Conservative approach : Run all tests Cheap approach : Run only tests whose test requirements relate to the statements that were changed Realistic approach : Consider how the changes propagate through the software Clearly, tests that never reach the modified statements do not need to be run Lots of clever algorithms to perform CIA have been invented Few if any available in commercial tools Introduction to Software Testing (Ch 6), Ammann & Offutt 42 21

22 Rationales for Selecting Tests to Re-Run Inclusive : A selection technique is inclusive if it includes tests that are modification revealing Unsafe techniques have less than 100% inclusiveness Precise : A selection technique is precise if it omits regression tests that are not modification revealing Efficient : A selection technique is efficient if deciding what tests to omit is cheaper than running the omitted tests This can depend on how much automation is available General : A selection technique is general if it applies to most practical situations Introduction to Software Testing (Ch 6), Ammann & Offutt 43 Identifying Correct Outputs (6.5) With simple software methods, we have a very clear idea whether outputs are correct or not But for most programs it s not so easy This section presents four general methods for checking outputs: Direct verification Redundant computation Consistency checks Data redundancy Introduction to Software Testing (Ch 6), 22

23 Direct Verification Appealing because it eliminates some human error Fairly expensive requiring more programming Verifying outputs is deceptively hard One difficulty is getting the post-conditions right Not always possible we do not always know the correct answer Flow calculations in a stream the solution is an approximation based on models and guesses; we don t know the correct answers! Probability of being in a particular state in a Petri net again, we don t know the correct answer Introduction to Software Testing (Ch 6), Ammann & Offutt 45 Direct Verification Example Consider a simple sort method Post-condition : Array is in sorted order Input Output Oops! Output Oops! Post-condition : Array sorted from lowest to highest and contains all the elements from the input array Input Output Oops! Post-condition : Array sorted from lowest to highest and is a permutation of the input array Introduction to Software Testing (Ch 6), Ammann & Offutt 46 23

24 Direct Verification Example Cont. Input : Array A Make copy B of A Sort A // Verify A is a permutation of B Check A and B are of the same size For each object in A Check if object appears in A and B the same number of times // Verify A is ordered for each index I but last in A Check if A [i] <= A [i+1] This is almost as complicated as the sort method under test! We can easily make mistakes in the verification methods Introduction to Software Testing (Ch 6), Ammann & Offutt 47 Redundant Computation Write two programs check that they produce the same answer Very expensive! Problem of coincident failures That is, both programs fail on the same input Sadly, the independent failure assumption is not valid in general This works best if completely different algorithms can be used Not clear exactly what completely different means Consider regression testing Current software checked against prior version Special form of redundant computation Clearly, independence assumption does not hold But still extremely powerful Introduction to Software Testing (Ch 6), Ammann & Offutt 48 24

25 Consistency Checks Check if a probability is negative or larger than one Check assertions or invariants No duplicates Cost is greater than zero Internal consistency constraints in databases or objects These are only partial solutions and does not always apply, but is very useful within those limits Introduction to Software Testing (Ch 6), Ammann & Offutt 49 Data Redundancy Check for identities Testing sin (x) : sin(a+b) = sin(a)cos(b) + cos(a)sin(b) Choose a at random Set b=x-a Note failure independence of sin(x), sin(a) Repeat process as often as desired; choose different values for a Possible to have arbitrarily high confidence in correctness assessment Inserting an element into a structure and removing it These are only partial solutions and does not always apply, but is very useful within those limits Introduction to Software Testing (Ch 6), Ammann & Offutt 50 25

26 Exercise Think of the software component in the systems you work on that is the most difficult to verify. Identify possibilities for the four oracle techniques discussed: Direct verification Redundant computation Consistency checks Data redundancy Class (c) 2009 Matthew J. Rutherford Integration and Testing (6.2) The polite word for this is risky Less polite words also exist The usual method is to start small, with a few classes that have been tested thoroughly Add a small number of new classes Test the connections between the new classes and pre-integrated classes Integration testing : testing interfaces between classes Should have already been tested in isolation (unit testing) Introduction to Software Testing (Ch 6), 26

27 Methods, Classes, Packages Integration can be done at the method level, the class level, package level, or at higher levels of abstraction Rather than trying to use all the words in every slide Or not using any specific word We use the word component in a generic sense A component is a piece of a program that can be tested independently Integration testing is done in several ways Evaluating two specific components Testing integration aspects of the full system Putting the system together piece by piece Introduction to Software Testing (Ch 6), Software Scaffolding Scaffolding is extra software components that are created to support integration and testing A stub emulates the results of a call to a method that has not been implemented or integrated yet A driver emulates a method that makes calls to a component that is being tested Driver Makes calls to methods in CUT Component Under Test (example: ADT) Stubs Emulates methods the CUT calls Introduction to Software Testing (Ch 6), 27

28 Stubs The first responsibility of a stub is to allow the CUT to be compiled and linked without error The signature must match What if the called method needs to return values? These values will not be the same the full method would return It may be important for testing that they satisfy certain limited constraints Approaches: Return constant values from the stub Return random values Return values from a table lookup Return values entered by the tester during execution Processing formal specifications of the stubbed method More costly / more effective Introduction to Software Testing (Ch 6), Mock Objects How can you unit-test program units that have dependencies? Mock Objects are a special kind of stub that is used when testing higher-level OO classes Class (c) 2009 Matthew J. Rutherford 28

29 Mock Objects Class (c) 2009 Matthew J. Rutherford Mock Objects Class (c) 2009 Matthew J. Rutherford 29

30 Drivers Many good programmers add drivers to every class as a matter of habit Instantiate objects and carry out simple testing Criteria from previous chapters can be implemented in drivers Test drivers can easily be created automatically Values can be hard-coded or read from files Introduction to Software Testing (Ch 6), Class Integration and Test Order (CITO) Old programs tended to be very hierarchical Which order to integrate was pretty easy: Test the leaves of the call tree Integrate up to the root Goal is to minimize the number of stubs needed OO programs make this more complicated Lots of kinds of dependencies (call, inheritance, use, aggregation) Circular dependencies : A inherits from B, B uses C, C aggregates A CITO : Which order should we integrate and test? Must break cycles Common goal : least stubbing Designs often have few cycles, but cycles creep in during implementation Introduction to Software Testing (Ch 6), 30

31 Test Activities Introduction to Software Testing (Ch 6), Test Activities (2) Introduction to Software Testing (Ch 6), 31

32 Test Plans (6.4) The most common question I hear about testing is How do I write a test plan? This question usually comes up when the focus is on the document, not the contents It s the contents that are important, not the structure Good testing is more important than proper documentation However documentation of testing can be very helpful Most organizations have a list of topics, outlines, or templates Introduction to Software Testing (Ch 6), Standard Test Plan ANSI / IEEE Standard is ancient but still used Many organizations are required to adhere to this standard Unfortunately, this standard emphasizes documentation, not actual testing often resulting in a well documented vacuum Introduction to Software Testing (Ch 6), 32

33 Types of Test Plans Mission plan tells why Usually one mission plan per organization or group Least detailed type of test plan Strategic plan tells what and when Usually one per organization, or perhaps for each type of project General requirements for coverage criteria to use Tactical plan tells how and who One per product More detailed Living document, containing test requirements, tools, results and issues such as integration order Introduction to Software Testing (Ch 6), Purpose Test Plan Contents System Testing Target audience and application Deliverables Information included Introduction Test items Features tested Features not tested Test criteria Pass / fail standards Criteria for starting testing Criteria for suspending testing Requirements for testing restart Hardware and software requirements Responsibilities for severity ratings Staffing & training needs Test schedules Risks and contingencies Approvals Introduction to Software Testing (Ch 6), 33

34 Test Plan Contents Tactical Testing Purpose Outline Test-plan ID Introduction Test reference items Features that will be tested Features that will not be tested Approach to testing (criteria) Criteria for pass / fail Criteria for suspending testing Criteria for restarting testing Test deliverables Testing tasks Environmental needs Responsibilities Staffing & training needs Schedule Risks and contingencies Approvals Introduction to Software Testing (Ch 6), 34

Fault-based testing. Automated testing and verification. J.P. Galeotti - Alessandra Gorla. slides by Gordon Fraser. Thursday, January 17, 13

Fault-based testing. Automated testing and verification. J.P. Galeotti - Alessandra Gorla. slides by Gordon Fraser. Thursday, January 17, 13 Fault-based testing Automated testing and verification J.P. Galeotti - Alessandra Gorla slides by Gordon Fraser How good are my tests? How good are my tests? Path testing Boundary interior testing LCSAJ

More information

Introduction to Software Testing Chapter 2.4 Graph Coverage for Design Elements Paul Ammann & Jeff Offutt

Introduction to Software Testing Chapter 2.4 Graph Coverage for Design Elements Paul Ammann & Jeff Offutt Introduction to Software Testing Chapter 2.4 Graph Coverage for Design Elements Paul Ammann & Jeff Offutt www.introsoftwaretesting.com OO Software and Designs Emphasis on modularity and reuse puts complexity

More information

Program-based Mutation Testing

Program-based Mutation Testing Program-based Mutation Testing CS 4501 / 6501 Software Testing [Ammann and Offutt, Introduction to Software Testing, Ch. 9.2] 1 Applying Syntax-Based Testing to Programs Test requirements are derived from

More information

ITI Introduction to Computing II

ITI Introduction to Computing II ITI 1121. Introduction to Computing II Marcel Turcotte School of Electrical Engineering and Computer Science Inheritance Introduction Generalization/specialization Version of January 20, 2014 Abstract

More information

ITI Introduction to Computing II

ITI Introduction to Computing II ITI 1121. Introduction to Computing II Marcel Turcotte School of Electrical Engineering and Computer Science Inheritance Introduction Generalization/specialization Version of January 21, 2013 Abstract

More information

Day 3. COMP 1006/1406A Summer M. Jason Hinek Carleton University

Day 3. COMP 1006/1406A Summer M. Jason Hinek Carleton University Day 3 COMP 1006/1406A Summer 2016 M. Jason Hinek Carleton University today s agenda assignments 1 was due before class 2 is posted (be sure to read early!) a quick look back testing test cases for arrays

More information

Introduction to Software Testing Chapter 5.1 Syntax-based Testing

Introduction to Software Testing Chapter 5.1 Syntax-based Testing Introduction to Software Testing Chapter 5.1 Syntax-based Testing Paul Ammann & Jeff Offutt http://www.cs.gmu.edu/~offutt/ softwaretest/ Ch. 5 : Syntax Coverage Four Structures for Modeling Software Graphs

More information

COP 3330 Final Exam Review

COP 3330 Final Exam Review COP 3330 Final Exam Review I. The Basics (Chapters 2, 5, 6) a. comments b. identifiers, reserved words c. white space d. compilers vs. interpreters e. syntax, semantics f. errors i. syntax ii. run-time

More information

Lecture 3. COMP1006/1406 (the Java course) Summer M. Jason Hinek Carleton University

Lecture 3. COMP1006/1406 (the Java course) Summer M. Jason Hinek Carleton University Lecture 3 COMP1006/1406 (the Java course) Summer 2014 M. Jason Hinek Carleton University today s agenda assignments 1 (graded) & 2 3 (available now) & 4 (tomorrow) a quick look back primitive data types

More information

Data Structures (list, dictionary, tuples, sets, strings)

Data Structures (list, dictionary, tuples, sets, strings) Data Structures (list, dictionary, tuples, sets, strings) Lists are enclosed in brackets: l = [1, 2, "a"] (access by index, is mutable sequence) Tuples are enclosed in parentheses: t = (1, 2, "a") (access

More information

Part I: Preliminaries 24

Part I: Preliminaries 24 Contents Preface......................................... 15 Acknowledgements................................... 22 Part I: Preliminaries 24 1. Basics of Software Testing 25 1.1. Humans, errors, and testing.............................

More information

Java Object Oriented Design. CSC207 Fall 2014

Java Object Oriented Design. CSC207 Fall 2014 Java Object Oriented Design CSC207 Fall 2014 Design Problem Design an application where the user can draw different shapes Lines Circles Rectangles Just high level design, don t write any detailed code

More information

Cmpt 135 Assignment 2: Solutions and Marking Rubric Feb 22 nd 2016 Due: Mar 4th 11:59pm

Cmpt 135 Assignment 2: Solutions and Marking Rubric Feb 22 nd 2016 Due: Mar 4th 11:59pm Assignment 2 Solutions This document contains solutions to assignment 2. It is also the Marking Rubric for Assignment 2 used by the TA as a guideline. The TA also uses his own judgment and discretion during

More information

Data Abstraction. Hwansoo Han

Data Abstraction. Hwansoo Han Data Abstraction Hwansoo Han Data Abstraction Data abstraction s roots can be found in Simula67 An abstract data type (ADT) is defined In terms of the operations that it supports (i.e., that can be performed

More information

Chapter 11. Categories of languages that support OOP: 1. OOP support is added to an existing language

Chapter 11. Categories of languages that support OOP: 1. OOP support is added to an existing language Categories of languages that support OOP: 1. OOP support is added to an existing language - C++ (also supports procedural and dataoriented programming) - Ada 95 (also supports procedural and dataoriented

More information

Compulsory course in Computer Science

Compulsory course in Computer Science Compulsory course in Computer Science University of Macau Faculty of Science and Technology Department of Computer and Information Science SFTW241 Programming Languages Architecture I Syllabus 2 nd Semester

More information

QUIZ. Write the following for the class Bar: Default constructor Constructor Copy-constructor Overloaded assignment oper. Is a destructor needed?

QUIZ. Write the following for the class Bar: Default constructor Constructor Copy-constructor Overloaded assignment oper. Is a destructor needed? QUIZ Write the following for the class Bar: Default constructor Constructor Copy-constructor Overloaded assignment oper. Is a destructor needed? Or Foo(x), depending on how we want the initialization

More information

Graph Coverage for Source Code. Data Flow Graph Coverage for Source Code

Graph Coverage for Source Code. Data Flow Graph Coverage for Source Code Graph Coverage for Source Code Data Flow Graph Coverage for Source Code 1 Graph Coverage for Design Elements Use of data abstraction and object oriented software has increased importance on modularity

More information

Programming II (CS300)

Programming II (CS300) 1 Programming II (CS300) Chapter 05: Inheritance and Interfaces MOUNA KACEM mouna@cs.wisc.edu Fall 2018 Inheritance and Interfaces 2 Introduction Inheritance and Class Hierarchy Polymorphism Abstract Classes

More information

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

Graphical Interface and Application (I3305) Semester: 1 Academic Year: 2017/2018 Dr Antoun Yaacoub Lebanese University Faculty of Science Computer Science BS Degree Graphical Interface and Application (I3305) Semester: 1 Academic Year: 2017/2018 Dr Antoun Yaacoub 2 Crash Course in JAVA Classes A Java

More information

Object-Oriented Software Engineering Practical Software Development using UML and Java

Object-Oriented Software Engineering Practical Software Development using UML and Java Object-Oriented Software Engineering Practical Software Development using UML and Java Chapter 5: Modelling with Classes Lecture 5 5.1 What is UML? The Unified Modelling Language is a standard graphical

More information

Overview of OOP. Dr. Zhang COSC 1436 Summer, /18/2017

Overview of OOP. Dr. Zhang COSC 1436 Summer, /18/2017 Overview of OOP Dr. Zhang COSC 1436 Summer, 2017 7/18/2017 Review Data Structures (list, dictionary, tuples, sets, strings) Lists are enclosed in square brackets: l = [1, 2, "a"] (access by index, is mutable

More information

CS-202 Introduction to Object Oriented Programming

CS-202 Introduction to Object Oriented Programming CS-202 Introduction to Object Oriented Programming California State University, Los Angeles Computer Science Department Lecture III Inheritance and Polymorphism Introduction to Inheritance Introduction

More information

Think of drawing/diagramming editors. ECE450 Software Engineering II. The problem. The Composite pattern

Think of drawing/diagramming editors. ECE450 Software Engineering II. The problem. The Composite pattern Think of drawing/diagramming editors ECE450 Software Engineering II Drawing/diagramming editors let users build complex diagrams out of simple components The user can group components to form larger components......which

More information

C++ Important Questions with Answers

C++ Important Questions with Answers 1. Name the operators that cannot be overloaded. sizeof,.,.*,.->, ::,? 2. What is inheritance? Inheritance is property such that a parent (or super) class passes the characteristics of itself to children

More information

Inheritance and Interfaces

Inheritance and Interfaces Inheritance and Interfaces Object Orientated Programming in Java Benjamin Kenwright Outline Review What is Inheritance? Why we need Inheritance? Syntax, Formatting,.. What is an Interface? Today s Practical

More information

CS-XXX: Graduate Programming Languages. Lecture 9 Simply Typed Lambda Calculus. Dan Grossman 2012

CS-XXX: Graduate Programming Languages. Lecture 9 Simply Typed Lambda Calculus. Dan Grossman 2012 CS-XXX: Graduate Programming Languages Lecture 9 Simply Typed Lambda Calculus Dan Grossman 2012 Types Major new topic worthy of several lectures: Type systems Continue to use (CBV) Lambda Caluclus as our

More information

Weiss Chapter 1 terminology (parenthesized numbers are page numbers)

Weiss Chapter 1 terminology (parenthesized numbers are page numbers) Weiss Chapter 1 terminology (parenthesized numbers are page numbers) assignment operators In Java, used to alter the value of a variable. These operators include =, +=, -=, *=, and /=. (9) autoincrement

More information

Day 2. COMP 1006/1406A Summer M. Jason Hinek Carleton University

Day 2. COMP 1006/1406A Summer M. Jason Hinek Carleton University Day 2 COMP 1006/1406A Summer 2016 M. Jason Hinek Carleton University today s agenda a quick look back (Monday s class) assignments a1 is due on Monday a2 will be available on Monday and is due the following

More information

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

Paytm Programming Sample paper: 1) A copy constructor is called. a. when an object is returned by value Paytm Programming Sample paper: 1) A copy constructor is called a. when an object is returned by value b. when an object is passed by value as an argument c. when compiler generates a temporary object

More information

Object Oriented Programming in Java. Jaanus Pöial, PhD Tallinn, Estonia

Object Oriented Programming in Java. Jaanus Pöial, PhD Tallinn, Estonia Object Oriented Programming in Java Jaanus Pöial, PhD Tallinn, Estonia Motivation for Object Oriented Programming Decrease complexity (use layers of abstraction, interfaces, modularity,...) Reuse existing

More information

Introduction to Software Testing Chapter 3, Sec# 3.3 Logic Coverage for Source Code

Introduction to Software Testing Chapter 3, Sec# 3.3 Logic Coverage for Source Code Introduction to Software Testing Chapter 3, Sec# 3.3 Logic Coverage for Source Code Paul Ammann & Jeff Offutt http://www.cs.gmu.edu/~offutt/soft waretest/ Logic Expressions from Source Predicates are derived

More information

Introduction to Software Testing Chapter 3.1, 3.2 Logic Coverage Paul Ammann & Jeff Offutt

Introduction to Software Testing Chapter 3.1, 3.2 Logic Coverage Paul Ammann & Jeff Offutt Introduction to Software Testing Chapter 3.1, 3.2 Logic Coverage Paul Ammann & Jeff Offutt www.introsoftwaretesting.com Ch. 3 : Logic Coverage Four Structures for Modeling Software Graphs Logic Input Space

More information

MARKING KEY The University of British Columbia MARKING KEY Computer Science 260 Midterm #2 Examination 12:30 noon, Thursday, March 15, 2012

MARKING KEY The University of British Columbia MARKING KEY Computer Science 260 Midterm #2 Examination 12:30 noon, Thursday, March 15, 2012 MARKING KEY The University of British Columbia MARKING KEY Computer Science 260 Midterm #2 Examination 12:30 noon, Thursday, March 15, 2012 Instructor: K. S. Booth Time: 70 minutes (one hour ten minutes)

More information

Topics in Software Testing

Topics in Software Testing Dependable Software Systems Topics in Software Testing Material drawn from [Beizer, Sommerville] Software Testing Software testing is a critical element of software quality assurance and represents the

More information

Day 4. COMP1006/1406 Summer M. Jason Hinek Carleton University

Day 4. COMP1006/1406 Summer M. Jason Hinek Carleton University Day 4 COMP1006/1406 Summer 2016 M. Jason Hinek Carleton University today s agenda assignments questions about assignment 2 a quick look back constructors signatures and overloading encapsulation / information

More information

Day 5. COMP1006/1406 Summer M. Jason Hinek Carleton University

Day 5. COMP1006/1406 Summer M. Jason Hinek Carleton University Day 5 COMP1006/1406 Summer 2016 M. Jason Hinek Carleton University today s agenda assignments Assignment 2 is in Assignment 3 is out a quick look back inheritance and polymorphism interfaces the Comparable

More information

What is software testing? Software testing is designing, executing and evaluating test cases in order to detect faults.

What is software testing? Software testing is designing, executing and evaluating test cases in order to detect faults. ϖοιδ τεσταδδανδχουντ() { ασσερ τεθυαλσ(1, ο.αδδανδχουντ(νεω ΑρραψΛιστ()); ϖοιδ τεσταδδανδχουντ() { ασσερ τεθυαλσ(1, ο.αδδανδχουντ(νεω ΑρραψΛιστ()); ιντ αδδανδχουντ(λιστ λιστ) { ρετυρν λιστ.σιζε(); ιντ

More information

Introduction to Software Testing Chapter 4 Input Space Partition Testing

Introduction to Software Testing Chapter 4 Input Space Partition Testing Introduction to Software Testing Chapter 4 Input Space Partition Testing Paul Ammann & Jeff Offutt http://www.cs.gmu.edu/~offutt/ softwaretest/ Ch. 4 : Input Space Coverage Four Structures for Modeling

More information

What s Conformance? Conformance. Conformance and Class Invariants Question: Conformance and Overriding

What s Conformance? Conformance. Conformance and Class Invariants Question: Conformance and Overriding Conformance Conformance and Class Invariants Same or Better Principle Access Conformance Contract Conformance Signature Conformance Co-, Contra- and No-Variance Overloading and Overriding Inheritance as

More information

Chapter 4 Defining Classes I

Chapter 4 Defining Classes I Chapter 4 Defining Classes I This chapter introduces the idea that students can create their own classes and therefore their own objects. Introduced is the idea of methods and instance variables as the

More information

Introduction to Software Testing Chapter 2, Sec#: 2.5 Graph Coverage for Specifications

Introduction to Software Testing Chapter 2, Sec#: 2.5 Graph Coverage for Specifications Introduction to Software Testing Chapter 2, Sec#: 2.5 Graph Coverage for Specifications Paul Ammann & Jeff Offutt http://www.cs.gmu.edu/~offutt/softwa retest/ Design Specifications A design specification

More information

Inf1-OP. Inf1-OP Exam Review. Timothy Hospedales, adapting earlier version by Perdita Stevens and Ewan Klein. March 20, School of Informatics

Inf1-OP. Inf1-OP Exam Review. Timothy Hospedales, adapting earlier version by Perdita Stevens and Ewan Klein. March 20, School of Informatics Inf1-OP Inf1-OP Exam Review Timothy Hospedales, adapting earlier version by Perdita Stevens and Ewan Klein School of Informatics March 20, 2017 Overview Overview of examinable material: Lectures Week 1

More information

Object-Oriented Design

Object-Oriented Design Object-Oriented Design Lecture 14: Design Workflow Department of Computer Engineering Sharif University of Technology 1 UP iterations and workflow Workflows Requirements Analysis Phases Inception Elaboration

More information

Inheritance and Encapsulation. Amit Gupta

Inheritance and Encapsulation. Amit Gupta Inheritance and Encapsulation Amit Gupta Project 1 How did it go? What did you like about it? What did you not like? What can we do to help? Suggestions Ask questions if you don t understand a concept

More information

Object-Oriented Software Engineering Practical Software Development using UML and Java. Chapter 5: Modelling with Classes

Object-Oriented Software Engineering Practical Software Development using UML and Java. Chapter 5: Modelling with Classes Object-Oriented Software Engineering Practical Software Development using UML and Java Chapter 5: Modelling with Classes 5.1 What is UML? The Unified Modelling Language is a standard graphical language

More information

CMSC 132: Object-Oriented Programming II

CMSC 132: Object-Oriented Programming II CMSC 132: Object-Oriented Programming II Java Support for OOP Department of Computer Science University of Maryland, College Park Object Oriented Programming (OOP) OO Principles Abstraction Encapsulation

More information

What are the characteristics of Object Oriented programming language?

What are the characteristics of Object Oriented programming language? What are the various elements of OOP? Following are the various elements of OOP:- Class:- A class is a collection of data and the various operations that can be performed on that data. Object- This is

More information

COMP 3705 Advanced Software Engineering: Software Testing

COMP 3705 Advanced Software Engineering: Software Testing COMP 3705 Advanced Software Engineering: Software Testing Prof. Matt Rutherford For Next Week Readings For Midterm: Chapter 1 and Sections 2.1-2.6, 3.1 3.5 New material: Chapter 4 Homework #5 http://mjrutherford.org/teaching/2009/winter/comp3705/homeworks

More information

Reviewing for the Midterm Covers chapters 1 to 5, 7 to 9. Instructor: Scott Kristjanson CMPT 125/125 SFU Burnaby, Fall 2013

Reviewing for the Midterm Covers chapters 1 to 5, 7 to 9. Instructor: Scott Kristjanson CMPT 125/125 SFU Burnaby, Fall 2013 Reviewing for the Midterm Covers chapters 1 to 5, 7 to 9 Instructor: Scott Kristjanson CMPT 125/125 SFU Burnaby, Fall 2013 2 Things to Review Review the Class Slides: Key Things to Take Away Do you understand

More information

CMSC 132: Object-Oriented Programming II

CMSC 132: Object-Oriented Programming II CMSC 132: Object-Oriented Programming II Java Support for OOP Department of Computer Science University of Maryland, College Park Object Oriented Programming (OOP) OO Principles Abstraction Encapsulation

More information

Absolute C++ Walter Savitch

Absolute C++ Walter Savitch Absolute C++ sixth edition Walter Savitch Global edition This page intentionally left blank Absolute C++, Global Edition Cover Title Page Copyright Page Preface Acknowledgments Brief Contents Contents

More information

Computer Science II (20073) Week 1: Review and Inheritance

Computer Science II (20073) Week 1: Review and Inheritance Computer Science II 4003-232-01 (20073) Week 1: Review and Inheritance Richard Zanibbi Rochester Institute of Technology Review of CS-I Hardware and Software Hardware Physical devices in a computer system

More information

Building custom components IAT351

Building custom components IAT351 Building custom components IAT351 Week 1 Lecture 1 9.05.2012 Lyn Bartram lyn@sfu.ca Today Review assignment issues New submission method Object oriented design How to extend Java and how to scope Final

More information

Lecture Topics. Administrivia

Lecture Topics. Administrivia ECE498SL Lec. Notes L8PA Lecture Topics overloading pitfalls of overloading & conversions matching an overloaded call miscellany new & delete variable declarations extensibility: philosophy vs. reality

More information

Chapter 9. Subprograms

Chapter 9. Subprograms Chapter 9 Subprograms Chapter 9 Topics Introduction Fundamentals of Subprograms Design Issues for Subprograms Local Referencing Environments Parameter-Passing Methods Parameters That Are Subprograms Calling

More information

Lesson 10A OOP Fundamentals. By John B. Owen All rights reserved 2011, revised 2014

Lesson 10A OOP Fundamentals. By John B. Owen All rights reserved 2011, revised 2014 Lesson 10A OOP Fundamentals By John B. Owen All rights reserved 2011, revised 2014 Table of Contents Objectives Definition Pointers vs containers Object vs primitives Constructors Methods Object class

More information

Ch. 12: Operator Overloading

Ch. 12: Operator Overloading Ch. 12: Operator Overloading Operator overloading is just syntactic sugar, i.e. another way to make a function call: shift_left(42, 3); 42

More information

CS11 Introduction to C++ Fall Lecture 7

CS11 Introduction to C++ Fall Lecture 7 CS11 Introduction to C++ Fall 2012-2013 Lecture 7 Computer Strategy Game n Want to write a turn-based strategy game for the computer n Need different kinds of units for the game Different capabilities,

More information

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

OOPs Concepts. 1. Data Hiding 2. Encapsulation 3. Abstraction 4. Is-A Relationship 5. Method Signature 6. Polymorphism 7. Constructors 8. OOPs Concepts 1. Data Hiding 2. Encapsulation 3. Abstraction 4. Is-A Relationship 5. Method Signature 6. Polymorphism 7. Constructors 8. Type Casting Let us discuss them in detail: 1. Data Hiding: Every

More information

Classes, Objects, and OOP in Java. June 16, 2017

Classes, Objects, and OOP in Java. June 16, 2017 Classes, Objects, and OOP in Java June 16, 2017 Which is a Class in the below code? Mario itsame = new Mario( Red Hat? ); A. Mario B. itsame C. new D. Red Hat? Whats the difference? int vs. Integer A.

More information

In this Lecture you will Learn: Testing in Software Development Process. What is Software Testing. Static Testing vs.

In this Lecture you will Learn: Testing in Software Development Process. What is Software Testing. Static Testing vs. In this Lecture you will Learn: Testing in Software Development Process Examine the verification and validation activities in software development process stage by stage Introduce some basic concepts of

More information

MTAT : Software Testing

MTAT : Software Testing MTAT.03.159: Software Testing Lecture 03: White-Box Testing (Textbook Ch. 5) Spring 2013 Dietmar Pfahl email: dietmar.pfahl@ut.ee Lecture Chapter 5 White-box testing techniques (Lab 3) Structure of Lecture

More information

QUIZ. What is wrong with this code that uses default arguments?

QUIZ. What is wrong with this code that uses default arguments? QUIZ What is wrong with this code that uses default arguments? Solution The value of the default argument should be placed in either declaration or definition, not both! QUIZ What is wrong with this code

More information

Chapter 5 Object-Oriented Programming

Chapter 5 Object-Oriented Programming Chapter 5 Object-Oriented Programming Develop code that implements tight encapsulation, loose coupling, and high cohesion Develop code that demonstrates the use of polymorphism Develop code that declares

More information

Testing! Prof. Leon Osterweil! CS 520/620! Spring 2013!

Testing! Prof. Leon Osterweil! CS 520/620! Spring 2013! Testing Prof. Leon Osterweil CS 520/620 Spring 2013 Relations and Analysis A software product consists of A collection of (types of) artifacts Related to each other by myriad Relations The relations are

More information

CPS 506 Comparative Programming Languages. Programming Language

CPS 506 Comparative Programming Languages. Programming Language CPS 506 Comparative Programming Languages Object-Oriented Oriented Programming Language Paradigm Introduction Topics Object-Oriented Programming Design Issues for Object-Oriented Oriented Languages Support

More information

Java Inheritance. Written by John Bell for CS 342, Spring Based on chapter 6 of Learning Java by Niemeyer & Leuck, and other sources.

Java Inheritance. Written by John Bell for CS 342, Spring Based on chapter 6 of Learning Java by Niemeyer & Leuck, and other sources. Java Inheritance Written by John Bell for CS 342, Spring 2018 Based on chapter 6 of Learning Java by Niemeyer & Leuck, and other sources. Review Which of the following is true? A. Java classes may either

More information

Conformance. Object-Oriented Programming Spring 2015

Conformance. Object-Oriented Programming Spring 2015 Conformance Object-Oriented Programming 236703 Spring 2015 1 What s Conformance? Overriding: replace method body in sub-class Polymorphism: subclass is usable wherever superclass is usable Dynamic Binding:

More information

Week 11: Class Design

Week 11: Class Design Week 11: Class Design 1 Most classes are meant to be used more than once This means that you have to think about what will be helpful for future programmers There are a number of trade-offs to consider

More information

Lecture 13: Object orientation. Object oriented programming. Introduction. Object oriented programming. OO and ADT:s. Introduction

Lecture 13: Object orientation. Object oriented programming. Introduction. Object oriented programming. OO and ADT:s. Introduction Lecture 13: Object orientation Object oriented programming Introduction, types of OO languages Key concepts: Encapsulation, Inheritance, Dynamic binding & polymorphism Other design issues Smalltalk OO

More information

Type Hierarchy. Comp-303 : Programming Techniques Lecture 9. Alexandre Denault Computer Science McGill University Winter 2004

Type Hierarchy. Comp-303 : Programming Techniques Lecture 9. Alexandre Denault Computer Science McGill University Winter 2004 Type Hierarchy Comp-303 : Programming Techniques Lecture 9 Alexandre Denault Computer Science McGill University Winter 2004 February 16, 2004 Lecture 9 Comp 303 : Programming Techniques Page 1 Last lecture...

More information

Subprograms. Copyright 2015 Pearson. All rights reserved. 1-1

Subprograms. Copyright 2015 Pearson. All rights reserved. 1-1 Subprograms Introduction Fundamentals of Subprograms Design Issues for Subprograms Local Referencing Environments Parameter-Passing Methods Parameters That Are Subprograms Calling Subprograms Indirectly

More information

// the current object. functioninvocation expression. identifier (expressionlist ) // call of an inner function

// the current object. functioninvocation expression. identifier (expressionlist ) // call of an inner function SFU CMPT 379 Compilers Spring 2015 Assignment 4 Assignment due Thursday, April 9, by 11:59pm. For this assignment, you are to expand your Bunting-3 compiler from assignment 3 to handle Bunting-4. Project

More information

Comp 311 Principles of Programming Languages Lecture 21 Semantics of OO Languages. Corky Cartwright Mathias Ricken October 20, 2010

Comp 311 Principles of Programming Languages Lecture 21 Semantics of OO Languages. Corky Cartwright Mathias Ricken October 20, 2010 Comp 311 Principles of Programming Languages Lecture 21 Semantics of OO Languages Corky Cartwright Mathias Ricken October 20, 2010 Overview I In OO languages, data values (except for designated non-oo

More information

Computer Science and Software Engineering University of Wisconsin - Platteville 9-Software Testing, Verification and Validation

Computer Science and Software Engineering University of Wisconsin - Platteville 9-Software Testing, Verification and Validation Computer Science and Software Engineering University of Wisconsin - Platteville 9-Software Testing, Verification and Validation Yan Shi SE 2730 Lecture Notes Verification and Validation Verification: Are

More information

Software Engineering Testing and Debugging Testing

Software Engineering Testing and Debugging Testing Software Engineering Testing and Debugging Testing Prof. Dr. Peter Thiemann Universitt Freiburg 08.06.2011 Recap Testing detect the presence of bugs by observing failures Debugging find the bug causing

More information

This course supports the assessment for Scripting and Programming Applications. The course covers 4 competencies and represents 4 competency units.

This course supports the assessment for Scripting and Programming Applications. The course covers 4 competencies and represents 4 competency units. This course supports the assessment for Scripting and Programming Applications. The course covers 4 competencies and represents 4 competency units. Introduction Overview Advancements in technology are

More information

QUIZ. How could we disable the automatic creation of copyconstructors

QUIZ. How could we disable the automatic creation of copyconstructors QUIZ How could we disable the automatic creation of copyconstructors pre-c++11? What syntax feature did C++11 introduce to make the disabling clearer and more permanent? Give a code example. QUIZ How

More information

STUDENT LESSON A20 Inheritance, Polymorphism, and Abstract Classes

STUDENT LESSON A20 Inheritance, Polymorphism, and Abstract Classes STUDENT LESSON A20 Inheritance, Polymorphism, and Abstract Classes Java Curriculum for AP Computer Science, Student Lesson A20 1 STUDENT LESSON A20 Inheritance, Polymorphism, and Abstract Classes INTRODUCTION:

More information

Chapter 6 Introduction to Defining Classes

Chapter 6 Introduction to Defining Classes Introduction to Defining Classes Fundamentals of Java: AP Computer Science Essentials, 4th Edition 1 Objectives Design and implement a simple class from user requirements. Organize a program in terms of

More information

COSC 2P95. Procedural Abstraction. Week 3. Brock University. Brock University (Week 3) Procedural Abstraction 1 / 26

COSC 2P95. Procedural Abstraction. Week 3. Brock University. Brock University (Week 3) Procedural Abstraction 1 / 26 COSC 2P95 Procedural Abstraction Week 3 Brock University Brock University (Week 3) Procedural Abstraction 1 / 26 Procedural Abstraction We ve already discussed how to arrange complex sets of actions (e.g.

More information

Inheritance and Substitution (Budd chapter 8, 10)

Inheritance and Substitution (Budd chapter 8, 10) Inheritance and Substitution (Budd chapter 8, 10) 1 2 Plan The meaning of inheritance The syntax used to describe inheritance and overriding The idea of substitution of a child class for a parent The various

More information

DRAFT: Prepublication draft, Fall 2014, George Mason University Redistribution is forbidden without the express permission of the authors

DRAFT: Prepublication draft, Fall 2014, George Mason University Redistribution is forbidden without the express permission of the authors Chapter 9 Syntax-based Testing Date last generated: September 29, 2014. DRAFT: Prepublication draft, Fall 2014, George Mason University Redistribution is forbidden without the express permission of the

More information

Coding and Unit Testing! The Coding Phase! Coding vs. Code! Coding! Overall Coding Language Trends!

Coding and Unit Testing! The Coding Phase! Coding vs. Code! Coding! Overall Coding Language Trends! Requirements Spec. Design Coding and Unit Testing Characteristics of System to be built must match required characteristics (high level) Architecture consistent views Software Engineering Computer Science

More information

Type Checking in COOL (II) Lecture 10

Type Checking in COOL (II) Lecture 10 Type Checking in COOL (II) Lecture 10 1 Lecture Outline Type systems and their expressiveness Type checking with SELF_TYPE in COOL Error recovery in semantic analysis 2 Expressiveness of Static Type Systems

More information

Inf1-OOP. OOP Exam Review. Perdita Stevens, adapting earlier version by Ewan Klein. March 16, School of Informatics

Inf1-OOP. OOP Exam Review. Perdita Stevens, adapting earlier version by Ewan Klein. March 16, School of Informatics Inf1-OOP OOP Exam Review Perdita Stevens, adapting earlier version by Ewan Klein School of Informatics March 16, 2015 Overview Overview of examinable material: Lectures Topics S&W sections Week 1 Compilation,

More information

Documentation (and midterm review)

Documentation (and midterm review) Documentation (and midterm review) Comp-303 : Programming Techniques Lecture 13 Alexandre Denault Computer Science McGill University Winter 2004 February 16, 2004 Lecture 13 Comp 303 : Programming Techniques

More information

Test Oracles and Mutation Testing. CSCE Lecture 23-11/18/2015

Test Oracles and Mutation Testing. CSCE Lecture 23-11/18/2015 Test Oracles and Mutation Testing CSCE 740 - Lecture 23-11/18/2015 Software Testing - Back to the Basics Tests are sequences of stimuli and observations. We care about input and output. (I 1 O 1 ) (I 2

More information

CONTENTS. PART 1 Structured Programming 1. 1 Getting started 3. 2 Basic programming elements 17

CONTENTS. PART 1 Structured Programming 1. 1 Getting started 3. 2 Basic programming elements 17 List of Programs xxv List of Figures xxix List of Tables xxxiii Preface to second version xxxv PART 1 Structured Programming 1 1 Getting started 3 1.1 Programming 3 1.2 Editing source code 5 Source code

More information

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

Computer Science 2 Lecture 4 Inheritance: Trinidad Fruit Stand 02/15/2014 Revision : 1.7 Computer Science 2 Lecture 4 Inheritance: Trinidad Fruit Stand 02/15/2014 Revision : 1.7 1 Problem Ralph owns the Trinidad Fruit Stand that sells its fruit on the street, and he wants to use a computer

More information

Testing Object-Oriented Software. 22 November 2017

Testing Object-Oriented Software. 22 November 2017 Testing Object-Oriented Software 22 November 2017 Testing Object-Oriented Software 2 Problems in object-oriented testing [Binder] Each level in the class hierarchy creates a new context for inherited features:

More information

Software Design Fundamentals. CSCE Lecture 11-09/27/2016

Software Design Fundamentals. CSCE Lecture 11-09/27/2016 Software Design Fundamentals CSCE 740 - Lecture 11-09/27/2016 Today s Goals Define design Introduce the design process Overview of design criteria What results in a good design? Gregory Gay CSCE 740 -

More information

CS 161 Computer Security

CS 161 Computer Security Wagner Spring 2014 CS 161 Computer Security 1/27 Reasoning About Code Often functions make certain assumptions about their arguments, and it is the caller s responsibility to make sure those assumptions

More information

QUIZ. How could we disable the automatic creation of copyconstructors

QUIZ. How could we disable the automatic creation of copyconstructors QUIZ How could we disable the automatic creation of copyconstructors pre-c++11? What syntax feature did C++11 introduce to make the disabling clearer and more permanent? Give a code example. Ch. 14: Inheritance

More information

CLASSES AND OBJECTS IN JAVA

CLASSES AND OBJECTS IN JAVA Lesson 8 CLASSES AND OBJECTS IN JAVA (1) Which of the following defines attributes and methods? (a) Class (b) Object (c) Function (d) Variable (2) Which of the following keyword is used to declare Class

More information

Late Binding; OOP as a Racket Pattern

Late Binding; OOP as a Racket Pattern Late Binding; OOP as a Racket Pattern Today Dynamic dispatch aka late binding aka virtual method calls Call to self.m2() in method m1 defined in class C can resolve to a method m2 defined in a subclass

More information

The pre-processor (cpp for C-Pre-Processor). Treats all # s. 2 The compiler itself (cc1) this one reads text without any #include s

The pre-processor (cpp for C-Pre-Processor). Treats all # s. 2 The compiler itself (cc1) this one reads text without any #include s Session 2 - Classes in C++ Dr Christos Kloukinas City, UoL http://staff.city.ac.uk/c.kloukinas/cpp (slides originally produced by Dr Ross Paterson) A C++ source file may contain: include directives #include

More information

Review sheet for Final Exam (List of objectives for this course)

Review sheet for Final Exam (List of objectives for this course) Review sheet for Final Exam (List of objectives for this course) Please be sure to see other review sheets for this semester Please be sure to review tests from this semester Week 1 Introduction Chapter

More information

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

Contents. I. Classes, Superclasses, and Subclasses. Topic 04 - Inheritance Contents Topic 04 - Inheritance I. Classes, Superclasses, and Subclasses - Inheritance Hierarchies Controlling Access to Members (public, no modifier, private, protected) Calling constructors of superclass

More information