Programming Errors. Errors of different types Syntax errors – easiest to fix, found by compiler or interpreter Semantic errors – logic errors, found by.

Slides:



Advertisements
Similar presentations
Programming Types of Testing.
Advertisements

CHAPTER 1: AN OVERVIEW OF COMPUTERS AND LOGIC. Objectives 2  Understand computer components and operations  Describe the steps involved in the programming.
Debugging Introduction to Computing Science and Programming I.
Python Programming Chapter 1: The way of the program Saad Bani Mohammad Department of Computer Science Al al-Bayt University 1 st 2011/2012.
16/13/2015 3:30 AM6/13/2015 3:30 AM6/13/2015 3:30 AMIntroduction to Software Development What is a computer? A computer system contains: Central Processing.
School of Computing Science CMT1000 Ed Currie © Middlesex University Lecture 2: 1 CMT1000: Introduction to Programming Ed Currie Lecture 2B: Programming.
If You Missed Last Week Go to Click on Syllabus, review lecture 01 notes, course schedule Contact your TA ( on website) Schedule.
Programming. Software is made by programmers Computers need all kinds of software, from operating systems to applications People learn how to tell the.
Activity 1 - WBs 5 mins Go online and spend a moment trying to find out the difference between: HIGH LEVEL programming languages and LOW LEVEL programming.
1 I.Introduction to Algorithm and Programming Algoritma dan Pemrograman – Teknik Informatika UK Petra 2009.
Peter Andreae Computer Science Victoria University of Wellington Copyright: Peter Andreae, Victoria University of Wellington Java Programs COMP 102 #3.
Python Mini-Course University of Oklahoma Department of Psychology Day 1 – Lesson 2 Fundamentals of Programming Languages 4/5/09 Python Mini-Course: Day.
Week 3 Part I Kyle Dewey. Overview Odds & Ends Constants Errors Functions Expressions versus statements.
© Janice Regan, CMPT 128, Jan CMPT 128 Introduction to Computing Science for Engineering Students Creating a program.
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.
ICS611 Introduction to Compilers Set 1. What is a Compiler? A compiler is software (a program) that translates a high-level programming language to machine.
Simple Program Design Third Edition A Step-by-Step Approach
Chapter 1.4 Programming languages Homework Due: Monday, August 11, 2014.
1 Computing Software. Programming Style Programs that are not documented internally, while they may do what is requested, can be difficult to understand.
PhD, Senior Lecturer, Baimuratov Olimzhon A LGORITHMS & P ROGRAMMING (P YTHON ) Lecture 1 From SDU:
Introduction to Programming ICS2O Findlay. Learning Goals  We will learn  The definitions of a computer, program and programming language.  The different.
IPC144 Introduction to Programming Using C Week 1 – Lesson 2
Software Overview. Why review software? Software is the set of instructions that tells hardware what to do The reason for hardware is to execute a program.
Programming Lifecycle
Program Development Life Cycle (PDLC)
Java Chapter 1 Problem solving: 1. Understanding the problem. 2. Breaking the problem into manageable pieces. 3. Designing a solution. 4. Considering alternatives.
Computer Programming TCP1224 Chapter 3 Completing the Problem-Solving Process and Getting Started with C++
Python – Part 1 Python Programming Language 1. What is Python? High-level language Interpreted – easy to test and use interactively Object-oriented Open-source.
Python From the book “Think Python”
© 2011 Pearson Addison-Wesley. All rights reserved. Addison Wesley is an imprint of Stewart Venit ~ Elizabeth Drake Developing a Program.
DEBUGGING. BUG A software bug is an error, flaw, failure, or fault in a computer program or system that causes it to produce an incorrect or unexpected.
Problem Solving Techniques. Compiler n Is a computer program whose purpose is to take a description of a desired program coded in a programming language.
C++ Programming Language Lecture 2 Problem Analysis and Solution Representation By Ghada Al-Mashaqbeh The Hashemite University Computer Engineering Department.
Chapter 1 Introduction Chapter 1 Introduction 1 st Semester 2015 CSC 1101 Computer Programming-1.
Errors “Computer says no..”. Types of Errors Many different types of errors new ones are being invented every day by industrious programming students..
Chapter 1 Program design Objectives To describe the steps in the program development process To introduce the current program design methodology To introduce.
Review, Pseudocode, Flow Charting, and Storyboarding.
Grammars Grammars can get quite complex, but are essential. Syntax: the form of the text that is valid Semantics: the meaning of the form – Sometimes semantics.
Compilers: Overview/1 1 Compiler Structures Objective – –what are the main features (structures) in a compiler? , Semester 1,
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.
Revise & Edit… What For? Ms. Brooks 2007.
Introduction to Testing CSIS 1595: Fundamentals of Programming and Problem Solving 1.
Intermediate 2 Computing Unit 2 - Software Development.
How to Program? -- Part 1 Part 1: Problem Solving –Analyze a problem –Decide what steps need to be taken to solve it. –Take into consideration any special.
School of Computer Science & Information Technology G6DICP - Lecture 6 Errors, bugs and debugging.
Peter Andreae Computer Science Victoria University of Wellington Copyright: Peter Andreae, Victoria University of Wellington Java Programs COMP 102 #3.
The Hashemite University Computer Engineering Department
5.01 Understand Different Types of Programming Errors
The single most important skill for a computer programmer is problem solving Problem solving means the ability to formulate problems, think creatively.
© Peter Andreae Java Programs COMP 102 # T1 Peter Andreae Computer Science Victoria University of Wellington.
Introduction to Computer Programming using Fortran 77.
Program Design. Simple Program Design, Fourth Edition Chapter 1 2 Objectives In this chapter you will be able to: Describe the steps in the program development.
Application architectures Advisor : Dr. Moneer Al_Mekhlafi By : Ahmed AbdAllah Al_Homaidi.
CHAPTER 3 COMPLETING THE PROBLEM- SOLVING PROCESS AND GETTING STARTED WITH C++ An Introduction to Programming with C++ Fifth Edition.
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.
5.01 Understand Different Types of Programming Errors
Programming Languages
CSCI-235 Micro-Computer Applications
Algorithm and Ambiguity
5.01 Understand Different Types of Programming Errors
Detecting and Resolving Model Errors
Programming Errors Key Revision Points.
Programming.
Algorithm and Ambiguity
Practical Grammar Workplace Guide ENG/230
Software Development Process
PROGRAMMING FUNDAMENTALS Lecture # 03. Programming Language A Programming language used to write computer programs. Its mean of communication between.
Learning Intention I will learn about the different types of programming errors.
Compiler Structures 1. Overview Objective
Presentation transcript:

Programming Errors

Errors of different types Syntax errors – easiest to fix, found by compiler or interpreter Semantic errors – logic errors, found by comparing results of test runs to expected results Runtime errors – errors caused by the environment, bad input, non- existent files – found by the operating system usually

Syntax errors Syntax = rules of a language that state how to write statements in the language You learned English syntax when you were in 3 rd – 5 th grades – punctuation, spelling, sentence diagramming Humans use English syntax but can manage if rules are broken E.E. Cummings = poet – did not follow English syntax rules well Computer language translators follow syntax rules rigidly Punctuation, order of statements, spelling of keywords, etc. must be correct Give instant feedback when error is detected Syntax rules do not tell you WHAT to say, just HOW to say it

Semantic errors Errors in meaning In English, there are lots of redundancies to prevent these kinds of errors – “subject number must agree with verb number”, “tenses must agree”, “pronouns must have noun to refer to” Computer languages – the semantics of a program is exactly “What does this program do when it is executed?” What does it make the computer do? Does it put something on the screen? Make a noise? Change something in memory? So it is very precise – every language has a standard document which specifies the semantics for every keyword The translators do NOT detect semantic errors!

How do you find semantic (logic) errors? Testing! Lots of testing! You develop a plan for testing which includes A description of the situation to be tested, e.g. “input file is empty” The Input given to cause this situation to happen, e.g. “a file with nothing in it” The expected output, e.g. “The program will stop with a message about no data” Then you run the program with those inputs and record what really happened “actual output” “The program crashed!” The better your test cases, the more certain you can be that your program is working correctly Can you prove a program has NO errors? For any program more than a few lines long, the answer is no

Runtime errors Usually caused by the environment “file not found” “Network connect is missing” “Insufficient data in file” Generally these will cause the program to halt with ugly error messages It is possible to program in such a way that these errors can be found by the program while it’s running – it is not easy. If found by the program, they are usually reported to the user and the program terminated – sometimes default value can be substituted for the missing items, etc.