Incremental Testing of Functions CSIS 1595: Fundamentals of Programming and Problem Solving 1.

Slides:



Advertisements
Similar presentations
Def f(n): if (n == 0): return else: print(“*”) return f(n-1) f(3)
Advertisements

Monday, 11/11/02, Slide #1 CS 106 Intro to Comp. Sci. 1 Monday, 11/11/02  Questions? HW 04 due today at 5.  Today – Lists and an introduction to searching.
Recursion (define tell-story (lambda () (print ‘’Once upon a time there was a mountain. ‘’) (print ‘’On the mountain, there was a temple. ‘’) (print ‘’In.
Computability Start complexity. Motivation by thinking about sorting. Homework: Finish examples.
Introduction to Functions Programming. COMP102 Prog Fundamentals I: Introduction to Functions /Slide 2 Introduction to Functions l A complex problem is.
James Tam Loops In Python In this section of notes you will learn how to rerun parts of your program without having to duplicate the code.
CS107 Introduction to Computer Science Loops. Instructions Pseudocode Assign values to variables using basic arithmetic operations x = 3 y = x/10 z =
Algorithms. Software Development Method 1.Specify the problem requirements 2.Analyze the problem 3.Design the algorithm to solve the problem 4.Implement.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Software Development Software Life Cycle UML Diagrams.
Ch3: Software Engineering Principles 1 What is a principle?  Definition:  Goals of accounting principles:  Goals of software engineering principles?
Program Design and Development
IS 1181 IS 118 Introduction to Development Tools Chapter 5 Reusing Code.
Computer Programming.  Analysis  User requirements  Feasibility and costs  Success criteria  Design and Planning  Classes  Data structures and.
Design and Analysis of Algorithms
CH07: Writing the Programs Does not teach you how to program, but point out some software engineering practices that you should should keep in mind as.
JS Arrays, Functions, Events Week 5 INFM 603. Agenda Arrays Functions Event-Driven Programming.
Python Programming Fundamentals
Testing. Definition From the dictionary- the means by which the presence, quality, or genuineness of anything is determined; a means of trial. For software.
Comp 245 Data Structures Software Engineering. What is Software Engineering? Most students obtain the problem and immediately start coding the solution.
Fortran 1- Basics Chapters 1-2 in your Fortran book.
Java Class Syntax CSIS 3701: Advanced Object Oriented Programming.
CMPSC 16 Problem Solving with Computers I Spring 2014 Instructor: Lucas Bang Lecture 15: Linked data structures.
Data Structures & AlgorithmsIT 0501 Algorithm Analysis I.
An Introduction to Programming and Algorithms. Course Objectives A basic understanding of engineering problem solving process. A basic understanding of.
Designing Programs with Branches CSIS 1595: Fundamentals of Programming and Problem Solving 1.
Software Life Cycle Requirements and problem analysis. –What exactly is this system supposed to do? Design –How will the system solve the problem? Coding.
Searching. Linear (Sequential) Search Search an array or list by checking items one at a time. Linear search is usually very simple to implement, and.
More Algorithm Design CSIS 1595: Fundamentals of Programming and Problem Solving 1.
Computing Science 1P Lecture 15: Friday 9 th February Simon Gay Department of Computing Science University of Glasgow 2006/07.
By: Lokman Chan Recursive Algorithm Recursion Definition: A function that is define in terms of itself. Goal: Reduce the solution to.
Branches and Program Design
Chapter 7 Functions. Types of Functions Value returning Functions that return a value through the use of a return statement They allow statements such.
CS320n –Visual Programming Introduction to Recursion (Slides 8-1) Thanks to Wanda Dann, Steve Cooper, and Susan Rodger for slide ideas.
1 Ch. 1: Software Development (Read) 5 Phases of Software Life Cycle: Problem Analysis and Specification Design Implementation (Coding) Testing, Execution.
Counter-Controlled Loops CSIS 1595: Fundamentals of Programming and Problem Solving 1.
Developing an Algorithm. Simple Program Design, Fourth Edition Chapter 3 2 Objectives In this chapter you will be able to: Introduce methods of analyzing.
Software Waterfall Life Cycle
Software Development Problem Analysis and Specification Design Implementation (Coding) Testing, Execution and Debugging Maintenance.
Unit Testing CSIS 3701: Advanced Object Oriented Programming.
Copyright © 2003 ProsoftTraining. All rights reserved. Perl Fundamentals.
Conditional Loops CSIS 1595: Fundamentals of Programming and Problem Solving 1.
Chapter 3 Object Interaction.  To construct interesting applications it is not enough to build individual objects  Objects must be combined so they.
Designing While Loops CSIS 1595: Fundamentals of Programming and Problem Solving 1.
Introduction to Testing CSIS 1595: Fundamentals of Programming and Problem Solving 1.
Running Totals CSIS 1595: Fundamentals of Programming and Problem Solving 1.
How to Test Methods Computer Science 3 Gerb Objective: Test methods properly.
Scoping and Namespaces CSIS 1595: Fundamentals of Programming and Problem Solving 1.
Principles of Programming - NI Simple Recursion Recursion is where a function calls itself. Concept of recursive function: A recursive function is.
Trigonometric Equations. Definition Example: Consider:
Compiler Directives. The C Preprocessor u The C preprocessor (cpp) changes your source code based on instructions, or preprocessor directives, embedded.
Unit Testing Part 2: Drivers and Stubs
CS321 Data Structures Jan Lecture 2 Introduction.
1. Searching The basic characteristics of any searching algorithm is that searching should be efficient, it should have less number of computations involved.
Introduction to Functions CSIS 1595: Fundamentals of Programming and Problem Solving 1.
CSci 162 Lecture 8 Martin van Bommel. Large-scale Programming Up to now we have been writing relatively short programs to solve simple problem Want to.
Complex Branching Statements CSIS 1595: Fundamentals of Programming and Problem Solving 1.
6.2 Classes “ A class is basically a structure with member functions as well as member data. Classes are central to the programming methodology known as.
CMPSC 16 Problem Solving with Computers I Spring 2014 Instructor: Tevfik Bultan Lecture 4: Introduction to C: Control Flow.
CREATE A POWERPOINT MUST CONTAIN AT LEAST 8SLIDES INCLUDE ALL KEY CONCEPTS /lo_ _CH10_ pdf.
Designing Functions CSIS 1595: Fundamentals of Programming and Problem Solving 1.
Testing Programs with Loops CSIS 1595: Fundamentals of Programming and Problem Solving 1.
Python – Part 4 Conditionals and Recursion. Conditional execution If statement if x>0:# CONDITION print (‘x is positive’) Same structure as function definition.
Lecture Five The Project 1. Wen Yu BNUZ LIMS Description Design a simple Library Information Management System (LIMS) for an university The system includes.
Fundamentals of Programming I Design with Functions
Topic: Functions – Part 2
CMSC201 Computer Science I for Majors Lecture 19 – Recursion
Linked Lists.
Transcendentalism Stations
COMS 261 Computer Science I
Problem solving.
Presentation transcript:

Incremental Testing of Functions CSIS 1595: Fundamentals of Programming and Problem Solving 1

Incremental Development Key idea: Build and test program one function at a time One method: – Start with “lower level” functions that do not call anything else Could build in order in which called, but not necessary – Implement functions that use tested methods If bug, most likely in function currently being developed – Finish with main program

Balloon Program Example Lowest level functions: – set_target() – get_velocity() – compute_miss(target, velocity, angle) – print_row(angle, miss_distance) Then build print_table(target, velocity) – Requires print_row be done first Then main program

Unit Testing Testing each function separately Requires – Function definition to be tested – Code to test the function Prompt for inputs (if any) Call function with inputs Print what it returns (if anything)

Unit Test Example

Unit Test Functions Can create “testing function” for each function – Should keep simple (just get input, call, and print) More complex testing function  More likely it has bugs! – Can use to retest a function at any time Bugs suspected Function changed in future versions) Do not delete!

Unit Test Function Example Can call from main during testing – If necessary, comment out actual main program during testing