Programming Errors Key Revision Points.

Slides:



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

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 in Visual Basic
I210 review Fall 2011, IUB. Python is High-level programming –High-level versus machine language Interpreted Language –Interpreted versus compiled 2.
Debugging Logic Errors CPS120 Introduction to Computer Science Lecture 6.
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.
© 2011 Pearson Addison-Wesley. All rights reserved. Addison Wesley is an imprint of Stewart Venit ~ Elizabeth Drake Developing a Program.
Fundamental Programming: Fundamental Programming Introduction to C++
Errors “Computer says no..”. Types of Errors Many different types of errors new ones are being invented every day by industrious programming students..
1. Understand how to catch errors in a program 2. Know how to filter user input to stop incorrect data.
Basic Programming Lingo. A program is also known as a  Sequence of instructions  Application  App  Binary  Executable.
1 Program Planning and Design Important stages before actual program is written.
Lesson - 2. Introduction When we make a program we must follow some steps, called Programming Development Life Cycle (PDLC). Programming steps are five:
COIT29222 Structured Programming 1 COIT29222-Structured Programming Lecture Week 02  Reading: Textbook(4 th Ed.), Chapter 2 Textbook (6 th Ed.), Chapters.
School of Computer Science & Information Technology G6DICP - Lecture 6 Errors, bugs and debugging.
ERRORS. Types of errors: Syntax errors Logical errors.
Programming Errors. Errors of different types Syntax errors – easiest to fix, found by compiler or interpreter Semantic errors – logic errors, found by.
PROGRAM ESSENTIALS. TOKENS  SMALLEST UNITS OF A PROGRAM LANGUAGE  Special Symbols  Mathematical Operators  Punctuation  Word Symbols  Key Words.
S ECURE P ROGRAMMING 6. B UFFER O VERFLOW (S TRINGS AND I NTEGERS ) P ART 2 Chih Hung Wang Reference: 1. B. Chess and J. West, Secure Programming with.
Chapter 9: Completing the Basics. In this chapter, you will learn about: – Exception handling – Exceptions and file checking – The string class – Character.
CS 177 Week 10 Recitation Slides 1 1 Debugging. Announcements 2 2.
5.01 Understand Different Types of Programming Errors
Testing.
AVCE ICT – Unit 7 - Programming Session 12 - Debugging.
Chapter 6 Testing and running a solution. Errors X Three types Syntax Logic Run-time.
Chapter 1: Introduction to Computers and Programming
5.01 Understand Different Types of Programming Errors
ME 142 Engineering Computation I
Jie(Jay) Wang Week1 Sept. 30
Component 1.6.
Data Types Variables are used in programs to store items of data e.g a name, a high score, an exam mark. The data stored in a variable is entered from.
CS170 – Week 1 Lecture 3: Foundation Ismail abumuhfouz.
Lecture 1 Introduction Richard Gesick.
7 - Programming 7P, Q, R - Testing.
Testing and Debugging.
Debugging and Random Numbers
Software Design and Development
A451 Theory – 7 Programming 7A, B - Algorithms.
G7 programing language Teacher / Shamsa Hassan Alhassouni.
Handling errors try except
Programming, Data & Testing
Exceptions and files Taken from notes by Dr. Neil Moore
Little work is accurate
Sentinel logic, flags, break Taken from notes by Dr. Neil Moore
Cracking the Coding Interview
Designing and Debugging Batch and Interactive COBOL Programs
Unit 2 Programming.
Topics Introduction to File Input and Output
Sentinel logic, flags, break Taken from notes by Dr. Neil Moore
Common C Programming Errors, GDB Debugging
Unit 1: Introduction Lesson 1: PArts of a java program
Exceptions and files Taken from notes by Dr. Neil Moore
Exception Handling and Reading / Writing Files
Detecting and Resolving Model Errors
Part B – Structured Exception Handling
Coding Concepts (Standards and Testing)
ERRORS AND EXCEPTIONS Errors:
Spot the bug!.
CSC128 FUNDAMENTALS OF COMPUTER PROBLEM SOLVING
(Oops! When things go wrong)
Algorithm Correctness
Managing Errors and Exceptions
Bugs & Debugging - Testing
Software Development Process
PROGRAMMING FUNDAMENTALS Lecture # 03. Programming Language A Programming language used to write computer programs. Its mean of communication between.
Lesson 2 Get Started with Python – Post-Installation – Use the GUI.
Errors in programming.
Topics Introduction to File Input and Output
WJEC GCSE Computer Science
CHAPTER 6 Testing and Debugging.
Presentation transcript:

Programming Errors Key Revision Points

TYPES OF ERROR Three types of error occur in programming: Syntax Errors Logical Errors Run time Errors

SYNTAX ERRORS Syntax = spelling, punctuation, grammar of a language Syntax errors occur when you enter code the compiler or interpreter doesn’t understand Misspelled commands or variable names Missing punctuation – brackets, speech marks etc. Incorrect indentation

SYNTAX ERRORS Easiest type of error to detect and correct Compiled languages wont compile with syntax errors

LOGIC ERRORS Logic errors occur when there is a fault in the logic or structure of the problem. Logic errors can be difficult to detect as they do not usually cause a program to crash. However, logic errors can cause a program to produce unexpected results

LOGIC ERROR EXAMPLES

LOGIC ERROR DETECTION Logic errors are detected through systematic testing to a test plan See pptx on testing

RUN TIME ERRORS Run time errors or exceptions may cause the program to crash They occur when the program receives unexpected or exceptional data: Trying to do a mathematical operation on a string Trying to convert a non-numeric string to an int Division by zero Out of range list indexes

RUN TIME ERRORS Run time errors can be avoided by programming defensively Try/except Validation in a while loop If/else Programmers try to anticipate how users might misuse the program and then try to prevent it from happening Well maintained (commented/annotated) code is also defensive programming – anyone using/adapting/updating your code will know exactly what range of values the code should accept