Lesson Outcomes 2.1.3 Be able to identify differentiate between types of error in programs 2.1.4 Be able to interpret error messages and identify, locate.

Slides:



Advertisements
Similar presentations
Debugging Techniques1. 2 Introduction Bugs How to debug Using of debugger provided by the IDE Exception Handling Techniques.
Advertisements

The IDE (Integrated Development Environment) provides a DEBUGGER for locating and correcting errors in program logic (logic errors not syntax errors) The.
Chapter 2: Input, Processing, and Output
1 CSE1301 Computer Programming: Lecture 15 Flowcharts, Testing and Debugging.
UNIT 3 TEMPLATE AND EXCEPTION HANDLING. Introduction  Program errors are also referred to as program bugs.  A C program may have one or more of four.
Programming Translators.
PROGRAMMING IN VISUAL BASIC.NET VISUAL BASIC BUILDING BLOCKS Bilal Munir Mughal 1 Chapter-5.
General Programming Introduction to Computing Science and Programming I.
Programming Lifecycle
CHAPTER 4: CONDITIONAL STRUCTURES Introduction to Computer Science Using Ruby (c) 2012 Ophir Frieder et al.
Computer Concepts 2014 Chapter 12 Computer Programming.
Cosc175/testing1 Testing Software errors are costly GIGO Preventing Errors –Echo checking –Range and limit checking –Defensive programming.
C++ Programming Language Lecture 2 Problem Analysis and Solution Representation By Ghada Al-Mashaqbeh The Hashemite University Computer Engineering Department.
Revision – part one. Starter – keywords... Revision list Data Representation Units of data.
CS Class 05 Topics  Selection: switch statement Announcements  Read pages 74-83, ,
XP Tutorial 10New Perspectives on HTML and XHTML, Comprehensive 1 Working with JavaScript Creating a Programmable Web Page for North Pole Novelties Tutorial.
Chapter 5: More on the Selection Structure
Debuggers in Python. The Debugger Every programming IDE has a tool called a debugger. This application does NOT locate or fix your bugs for you! It slows.
Software Development Problem Analysis and Specification Design Implementation (Coding) Testing, Execution and Debugging Maintenance.
Error Handling Tonga Institute of Higher Education.
Chapter Topics 2.1 Designing a Program 2.2 Output, Input, and Variables 2.3 Variable Assignment and Calculations 2.4 Variable Declarations and Data Types.
Midterm Exam Topics (Prof. Chang's section) CMSC 201.
5.01 Understand Different Types of Programming Errors
The Department of Engineering Science The University of Auckland Welcome to ENGGEN 131 Engineering Computation and Software Development Lecture 2 Debugging,
Higher Computing Science 2016 Prelim Revision. Topics to revise Computational Constructs parameter passing (value and reference, formal and actual) sub-programs/routines,
CS Class 04 Topics  Selection statement – IF  Expressions  More practice writing simple C++ programs Announcements  Read pages for next.
COMPUTER PROGRAMMING I SUMMER Understand Different Types of Programming Errors.
1 CSE1301 Computer Programming: Lecture 16 Flow Diagrams and Debugging.
An Introduction to Programming with C++ Sixth Edition Chapter 5 The Selection Structure.
Program Control: Selection Subject: T0016 – ALGORITHM AND PROGRAMMING Year: 2013.
Program Control: Selection Subject: T0016 – ALGORITHM AND PROGRAMMING Year: 2013.
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.
MOOR ERROR HANDLING Types of error How to test your code for errors How to detect errors How to recover from errors.
The Department of Engineering Science The University of Auckland Welcome to ENGGEN 131 Engineering Computation and Software Development Lecture 2 Debugging,
PYTHON PROGRAMMING Year 9. Objective and Outcome Teaching Objective Today we will look at conditional statements in order to understand how programs can.
Collision Theory and Logic
Exceptions in Python Error Handling.
Introduction to Computing Science and Programming I
5.01 Understand Different Types of Programming Errors
Collision Theory and Logic
Chapter 2: Input, Processing, and Output
Can you pick 3 errors from this
SDC – SDLC integration.
Software Design and Development
The Selection Structure
Chapter Topics 2.1 Designing a Program 2.2 Output, Input, and Variables 2.3 Variable Assignment and Calculations 2.4 Variable Declarations and Data Types.
CSS 161: Fundamentals of Computing
Understand the Programming Process
Programming, Data & Testing
Control Structures – Selection
TRANSLATORS AND IDEs Key Revision Points.
Computer Programming.
Cracking the Coding Interview
5.01 Understand Different Types of Programming Errors
Lecture 2 Python Programming & Data Types
Understand the Programming Process
Chapter 5: Control Structure
Lecture 2 Python Programming & Data Types
Software Development Process
PYTHON: BUILDING BLOCKS Sequencing & Selection
ICT Gaming Lesson 2.
CHAPTER 4: Conditional Structures
Chapter 3 Selections Liang, Introduction to Java Programming, Ninth Edition, (c) 2013 Pearson Education, Inc. All rights reserved.
Starter....
Chapter 2: Input, Processing, and Output
Review of Previous Lesson
Introduction to Python
Variables, Constants, Assign.
Chapter 15 Debugging.
Presentation transcript:

Lesson Outcomes 2.1.3 Be able to identify differentiate between types of error in programs 2.1.4 Be able to interpret error messages and identify, locate and fix errors in a program. 2.1.7 Be able to make effective use of tools offered in an integrated development environment [watcher, break points, single step, step throughs] What causes error messages All of should be able to recall different error types All of you should be able to recall error messages in python All of you should be able to use a trace table All of you should be able to use a debugger software

Quick recap – Error handling keywords Syntax Run time Logic

Testing for logic errors Trace Table A technique used to test algorithms to see if any logic errors occur when the algorithm is processed. Testing for logic errors

Are you happy with this function? Example 1 Are you happy with this function? for next in range(1,10,2): number1 = next number2 = next * next number3 = next / 2 next number1 number2 number3

Example 1 for next in range(1,10,2): number1 = next number2 = next * next number3 = next / 2 next number1 number2 number3 1 0.5 3 9 1.5 5 25 2.5 7 49 3.5 81 4.5

Example 2 C A B A = 3 B = 3 For C = 1 to 4 B = B*C A = A+C Next C

Example 2 C A B 1 4 3 2 6 9 18 13 72 (Psueudocode) A = 3 B = 3 For C = 1 to 4 B = B*C A = A+C Next C

Example 3 Pseudocode A=4 B=7 1 Input A 2 Input B 3 If A=B Then 4 B = 2 5 Else 6 While B>A 7 B=B-A 8 End While 9 A = B + 5 10 End IF Variable Line A B Comment 1 2 3 4 5 6 7 8 9 10

Example 3 Pseudocode A=4 B=7 1 Input A 2 Input B 3 If A=B Then 4 B = 2 5 Else 6 While B>A 7 B=B-A 8 End While 9 A = B + 5 10 End IF Variable Line A B Comment 1 4 2 7 3 False: goto 6 5 6 True: continue 8 9 10

Break.... Which is the odd one out? Type Error Runtime NameError Variableinterupt ZeroDivisionError KeyBoardInterrupt Typeinputerror

Object Orientated Programming Bugs can be hard to find... Constant Assignment Data System Information Array / list Variable Algorithm Boolean Data structure Pseudocode Find it... Object Orientated Programming Integer Binary Identifier Real / Float

“Debug tools” or “Debugger” Single step (where the program is executed one statement at a time – performs a ‘step through’ Setbreak points (Positions in the program when its halted and variables can be checked to locate logic errors) Watchers (Allow a programmer to watch for certain events such as variables changing)

Debugger in Python

The best way to learn about it...is to use it. Your task: Over to you... Take some of your programs and use the debugger (rock, paper, scissors game?) Then take an old program you have made (sabotage it and look at how it might pick it up)

Homework For next lesson (Tuesday)