ME 142 Engineering Computation I

Slides:



Advertisements
Similar presentations
Topics Introduction Types of Errors Exceptions Exception Handling
Advertisements

Why care about debugging? How many of you have written a program that worked perfectly the first time? No one (including me!) writes a program that works.
Chapter 3: Editing and Debugging SAS Programs. Some useful tips of using Program Editor Add line number: In the Command Box, type num, enter. Save SAS.
Programming Types of Testing.
General Computer Science for Engineers CISC 106 Lecture 21 Dr. John Cavazos Computer and Information Sciences 04/10/2009.
Microsoft Excel 2003 Illustrated Complete with Excel Programming.
The IDE (Integrated Development Environment) provides a DEBUGGER for locating and correcting errors in program logic (logic errors not syntax errors) The.
1 Chapter 4 The Fundamentals of VBA, Macros, and Command Bars.
Finding and Debugging Errors
Computer Programming and Basic Software Engineering 4. Basic Software Engineering 1 Writing a Good Program 4. Basic Software Engineering.
Debugging applications, using properties Jim Warren – COMPSCI 280 S Enterprise Software Development.
Programming Translators.
XP Chapter 7 Succeeding in Business with Microsoft Office Access 2003: A Problem-Solving Approach 1 Enhancing User Interaction Through Programming Chapter.
Enhancing User Interaction Through Programming
PROGRAMMING IN VISUAL BASIC.NET VISUAL BASIC BUILDING BLOCKS Bilal Munir Mughal 1 Chapter-5.
Automating Database Processing Chapter 6. Chapter Introduction Design and implement user-friendly menu – Called navigation form Macros – Automate repetitive.
Chapter 02 (Part III) Introduction to C++ Programming.
ME 142 Engineering Computation I Debugging Techniques.
1 Κατανεμημένες Διαδικτυακές Εφαρμογές Πολυμέσων Γιάννης Πετράκης.
Lecture 4 Programming Technique Programming Appreciation.
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 8 Debugging, Creating Executable Files, and Distributing a Windows Application.
1 Program Planning and Design Important stages before actual program is written.
1 Debugging and Syntax Errors in C++. 2 Debugging – a process of finding and fixing bugs (errors or mistakes) in a computer program.
CS 177 Week 10 Recitation Slides 1 1 Debugging. Announcements 2 2.
5.01 Understand Different Types of Programming Errors
AVCE ICT – Unit 7 - Programming Session 12 - Debugging.
Chapter 7 What’s Wrong with It? (Syntax and Logic Errors) Clearly Visual Basic: Programming with Visual Basic nd Edition.
COMPUTER PROGRAMMING I SUMMER Understand Different Types of Programming Errors.
Debugging M-Files Steve Gu Feb 08, Outline What’s Debugging? Types of Errors Finding Errors Debugging Example Using Debugging Features.
Chapter 4.  Variables – named memory location that stores a value.  Variables allows the use of meaningful names which makes the code easier to read.
Chapter 6 Testing and running a solution. Errors X Three types Syntax Logic Run-time.
Harvard Mark I Howard Aiken was a pioneer in computing and a creator of conceptual design for IBM in the 1940s. He envisioned an electro-mechanical computing.
Debuggers. Errors in Computer Code Errors in computer programs are commonly known as bugs. Three types of errors in computer programs –Syntax errors –Runtime.
DEVRY CIS 170 C I L AB 1 OF 7 G ETTING S TARTED Check this A+ tutorial guideline at
Excel Tutorial 8 Developing an Excel Application
Chapter 2: The Visual Studio .NET Development Environment
5.01 Understand Different Types of Programming Errors
Debugging and Handling Exceptions
How to debug an application
CSC201: Computer Programming
Introduction to Programming and Visual Basic
Appendix A Barb Ericson Georgia Institute of Technology May 2006
CS1101X Programming Methodology
Chapter 2 - Introduction to C Programming
Topics Introduction to Repetition Structures
The Software Development Cycle
Testing and Debugging.
CHAPTER FIVE Decision Structures.
2_Testing Testing techniques.
Chapter 2 - Introduction to C Programming
Topics Introduction to Repetition Structures
Microsoft Access Illustrated
Objectives Learn about Function procedures (functions), Sub procedures (subroutines), and modules Review and modify an existing subroutine in an event.
CHAPTER FIVE Decision Structures.
Variables and Arithmetic Operations
5.01 Understand Different Types of Programming Errors
Designing and Debugging Batch and Interactive COBOL Programs
Conditions and Ifs BIS1523 – Lecture 8.
Introduction to C++ Programming
Detecting and Resolving Model Errors
MyFloridaMarketPlace
Programming Errors Key Revision Points.
Debugging Visual Basic Programs
PROGRAMMING FUNDAMENTALS Lecture # 03. Programming Language A Programming language used to write computer programs. Its mean of communication between.
Boolean Expressions to Make Comparisons
Topics Introduction to Repetition Structures
12th Computer Science – Unit 5
Debugging and Handling Exceptions
Tutorial 10 Automating Tasks with Macros
CHAPTER 6 Testing and Debugging.
Presentation transcript:

ME 142 Engineering Computation I Debugging Techniques

Key Concepts Types of Program Errors Debugging Tools & Techniques Testing

Types of Programming Errors Syntax Errors Run-Time Errors Logic Errors

Syntax Errors Syntax errors occur when the rules of the programming language are violated. Examples: Misspelling a keyword or function name Misplacement or omission of a parenthesis or quote mark Omission of necessary keywords in a command.

Run-Time Errors Runtime errors are those errors that occur when a program free of syntax errors, runs and generates an error. Examples: Attempting an invalid operation such as division by zero Providing the wrong data type to a function.

Logic Errors Logic errors are due to incorrect program logic. The program may run without errors The results it returns are inaccurate. Often the most difficult to locate

Debugging Tools & Techniques MsgBox Function Debug.Print Statement Debug Mode

MsgBox Statement Place MsgBox statement in your code as desired Causes the value of the variables to be immediately displayed in a dialog box and pauses execution of program Example: MsgBox (“A = “ & A)

Debug.Print Statement Place Debug.Print statement in your code as you would MsgBox function Causes the value of the variables to be printed in the Immediate window Example: Debug.Print A,B,C

Debug.Print Statement

Debug Mode Allows you step through your program and examine the value of variables at specific points May step through line-by-line or set specific breakpoints

Debug Mode When a run-time error occurs may enter Debug Mode by selecting button on dialog box that appears:

Debug Mode Once in Debug Mode may mouse-over a variable to find its current value:

Debug Mode May also hit the F8 key to single step through the program Each time the F8 key is hit, one line of code is executed:

Debug Mode May also set a breakpoint by clicking in the gray column on the left side of the line of code you want to program to pause on Click on run (from menu above) to cause the program to resume

Debug Mode Another powerful feature to use in conjunction with the previous techniques is the Locals Window It displays the current value of all local variables in your program

Testing Deadly Misconception of Beginning Programmers: If a program runs without errors, the results must be correct Very important that before you use your program to make engineering decisions (or turn it in to get a grade in class) that you perform a series of test to make certain that the output is correct.

Testing Suggestions Compare your results to that of a simple, known problem by using a calculator or Excel Test a typical range of inputs Test unusual but valid data Test extreme values