Programming Translators.

Slides:



Advertisements
Similar presentations
Copyright © 2002 W. A. Tucker1 Chapter 1 Lecture Notes Bill Tucker Austin Community College COSC 1315.
Advertisements

Programming Types of Testing.
Chapter 2- Visual Basic Schneider1 Chapter 2 Problem Solving.
Debugging Techniques1. 2 Introduction Bugs How to debug Using of debugger provided by the IDE Exception Handling Techniques.
Lecture Roger Sutton CO331 Visual programming 15: Debugging 1.
Programming Creating programs that run on your PC
The IDE (Integrated Development Environment) provides a DEBUGGER for locating and correcting errors in program logic (logic errors not syntax errors) The.
Chapter 16 Programming and Languages: Telling the Computer What to Do.
Chapter 1 Program Design
Introduction Algorithms and Programming. Computer Programming  A form of problem solving  Or, more accurately, a way to solve problems  What we will.
Programming. Software is made by programmers Computers need all kinds of software, from operating systems to applications People learn how to tell the.
Programming Concepts and Languages Chapter 12 – Computers: Understanding Technology, 3 rd edition 1November
Chapter 1: Introduction To Computer | SCP1103 Programming Technique C | Jumail, FSKSM, UTM, 2005 | Last Updated: July 2005 Slide 1 Introduction To Computers.
C++ Crash Course Class 1 What is programming?. What’s this course about? Goal: Be able to design, write and run simple programs in C++ on a UNIX machine.
Concept of Computer Programming November 2, 2011.
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.
CCSA 221 Programming in C CHAPTER 2 SOME FUNDAMENTALS 1 ALHANOUF ALAMR.
© Janice Regan, CMPT 128, Jan CMPT 128 Introduction to Computing Science for Engineering Students Creating a program.
1 Shawlands Academy Higher Computing Software Development Unit.
GENERAL CONCEPTS OF OOPS INTRODUCTION With rapidly changing world and highly competitive and versatile nature of industry, the operations are becoming.
Programming. What is a Program ? Sets of instructions that get the computer to do something Instructions are translated, eventually, to machine language.
1 Computing Software. Programming Style Programs that are not documented internally, while they may do what is requested, can be difficult to understand.
PROGRAMMING LANGUAGES Prof. Lani Cantonjos. PROGRAM - set of step-by-step instructions that tells or directs the computer what to do. PROGRAMMING LANGUAGE.
Programming Lifecycle
Program Development Life Cycle (PDLC)
Describe the Program Development Cycle. Program Development Cycle The program development cycle is a series of steps programmers use to build computer.
20/10/ Working with Data Declaring Variables, Overflow.
Testing and Debugging Version 1.0. All kinds of things can go wrong when you are developing a program. The compiler discovers syntax errors in your code.
© 2011 Pearson Addison-Wesley. All rights reserved. Addison Wesley is an imprint of Stewart Venit ~ Elizabeth Drake Developing a Program.
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.
1 Κατανεμημένες Διαδικτυακές Εφαρμογές Πολυμέσων Γιάννης Πετράκης.
The Software Development Process
1 Program Planning and Design Important stages before actual program is written.
CHAPTER 1 INTRODUCTION 2 nd Semester H King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1.
Data Structure Introduction Dr. Bernard Chen Ph.D. University of Central Arkansas Fall 2010.
Computer and Programming. Computer Basics: Outline Hardware and Memory Programs Programming Languages and Compilers.
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.
5.01 Understand Different Types of Programming Errors
1 The Software Development Process ► Systems analysis ► Systems design ► Implementation ► Testing ► Documentation ► Evaluation ► Maintenance.
Testing.
Chapter 1: Introduction to Visual Basic.NET: Background and Perspective Visual Basic.NET Programming: From Problem Analysis to Program Design.
The Functions and Purposes of Translators Translators, Interpreters and Compilers - High Level Languages.
Principles of Programming CSEB134 : BS/ CHAPTER Fundamentals of the C Programming Language.
Compilers and Interpreters
Introduction to Computer Programming using Fortran 77.
COMPUTER PROGRAMMING I SUMMER Understand Different Types of Programming Errors.
INTRODUCTION TO COMPUTER PROGRAMMING(IT-303) Basics.
Introduction to Computer Programming Concepts M. Uyguroğlu R. Uyguroğlu.
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.
Victoria Ibarra Mat:  Generally, Computer hardware is divided into four main functional areas. These are:  Input devices Input devices  Output.
Debuggers. Errors in Computer Code Errors in computer programs are commonly known as bugs. Three types of errors in computer programs –Syntax errors –Runtime.
The LC-3 – Chapter 6 COMP 2620 Dr. James Money COMP
5.01 Understand Different Types of Programming Errors
ME 142 Engineering Computation I
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.
Software Design and Development
A451 Theory – 7 Programming 7A, B - Algorithms.
Lecture 2 Introduction to Programming
Programming Concepts and Languages
TRANSLATORS AND IDEs Key Revision Points.
Computer Programming.
5.01 Understand Different Types of Programming Errors
Programming.
Algorithm and Ambiguity
1 Identifiers / Variables
Review of Previous Lesson
WJEC GCSE Computer Science
Dasar-Dasar Pemrograman 2: Java Basics
Presentation transcript:

Programming Translators

Learning Objectives Explain: What translators do The process of source-object code The three major error types which will need to be tested The concept of developing a test plan. Black box testing White box testing The concepts of Alpha tests and Beta tests Translator diagnostics Cross referencing Program traces Variable dumps Dry runs (desk checks)

Software The general term used to describe all the programs, routines or procedures that run on a computer. Makes a computer do something and are written to run on the hardware. Computer instructions or data. Any instructions that can be stored electronically are software.

Software Software Hardware Computer instructions or data. Makes a computer do something and are written to run on the hardware. Hardware Software

e.g. Pascal, Visual Basic, C, Fortran Software is usually written in a high level language which is fairly similar to our own spoken languages. This makes it easier for us humans to use. However, computers only understand machine code which is in binary form (1s and 0s). Hardware High Level Languages e.g. Pascal, Visual Basic, C, Fortran Machine Code

Translators Translate high level languages (the translator’s source code) into machine code (the translator’s object code) which can be executed by a computer. Translators High Level Languages Machine Code Source Code Object Code written in a high level language. Code in executable form.

There are three types program error (bug)

1. Syntax errors Errors in a program that break the grammar rules of the language being used. e.g. PLINT instead of PRINT 3*(2+A) = X instead of X = 3*(2+A) Simplest errors to solve as the translator will find these errors before the program is run.

Translator diagnostics The translator looks up each word from a program in a dictionary. The dictionary tells the translator program what the rules are for that particular word. A wrongly typed word will not appear in the dictionary. If rules governing how it should be used have not been followed properly, the translator will know that there is something wrong. Either way, the translator program knows that a mistake has been made, it knows where the mistake is and, often, it also knows what mistake has been made.

Translator diagnostics Messages detailing syntax errors sent to the programmer and usually giving hints as to what to do.

2. Logic errors (also known as run-time errors if found when a program is run) A mistake in the way the program solution has been designed. e.g. An instruction in a program may tell the computer to jump to the wrong part of the program. Total_number = Previous_total – New_number Known as logic errors if found whilst not running a program and using white box testing – see later slide 24. Known as run-time errors if found when actually running a program (black box testing – see slide 17).

3. Arithmetic Errors (also known run-time errors if found when a program is run) Inappropriate use of arithmetic. E.g. dividing by zero Known as arithmetic errors if found whilst not running a program and using white box testing – see later slide 24. Known as run-time errors if found when actually running a program (black box testing – see slide 17).

The last two errors (logic and arithmetic) will not be found by the translator, so the program will run but won’t work properly. Known collectively as run-time errors if found when actually running a program (black box testing – see slide 17).

Program Development Testing: Debugging: Are there any errors (bugs)? Where is the error (bug) and what is causing it? Solve the error (bug).

Test Plan A schedule drawn up which contains a test for every type of input that could be made and methods of testing that the program actually does what it was meant to do.

Alpha Testing Performed by the programmers involved in writing the program. Focus on error free processing.

Black box testing Use of different input values to determine whether the program can cope with them. These values should include Different types of input e.g. Typical values Borderline values Unacceptable values Cannot see into the box (program) all you see is what comes out at the end.

Example 1 of Black Box Testing A program which uses marks out of 100 from a math's examination as input. Typical data like: 27, 73.., Borderline data: 0 and 100 Unacceptable data like: –34, 123, 16.345

Example 2 of Black Box Testing A program to work out the mean of three numbers. 1, 2, 3 Will integers give an integer answer? 1, 2, 4 Can the software cope with a recurring decimal answer? (Note that “1, 2, 4 to test a different set of integers” would not get a mark because the reason for the test is not different) 1, 2.5, 3 Can the program handle decimal inputs? 1, 2½, 3 Are fractions allowed? -1, -2, -3 Can negative numbers be handled? 1, 2 What happens when only two values are input?

Debugging Tools Debugging tools to allow programmers to investigate conditions where errors occur. The following slides describe some debugging tools.

Cross-referencing This software checks the program that has been written and finds places where particular variables have been used. This lets the programmer check to make sure that the same variable has not been used twice for different things.

Tracing variable values / Variable Watching / Stepping Where the program is run and the values of all the relevant variables are printed out, as are the individual instructions, as each instruction is executed. In this way, the values can be checked to see where they suddenly change or take on an unexpected value.

Break Points / Variable dumps / Variable Watches At specified parts of the program, the values of all the variables are displayed to enable the user to compare them with the expected results. This enables the programmer to see where sudden, unexpected changes occur. Often used in conjunction with tracing variable values / Variable Watching / Stepping i.e. set breakpoints and then use tracing from these points as required. Particularly useful for long programs where errors are believed to be only in certain parts of the code.

White Box Testing / Dry Runs / Desk Checking The user works through every logical path of the program instructions manually, keeping track of the values of the variables. Basically manual tracing or variable watches. Most computer programs require a very large number of instructions to be carried out, so it is usual to only dry run small segments of code that the programmer suspects of harboring an error. Testing knowing the code. Testing the structure and logic of all the algorithms within the code. Known as “white box” as testing is done by looking at the code so the program is like a transparent box.

Beta Testing Testing carried out by the users of the program. Eventually, the company will want ordinary users to test the program because they are likely to find errors that the programmers did not find. Focus on usability, functionality, and performance.

Plenary What is: Source code? Code written in hll. Object code? Code in executable form Machine code? Code in binary form. What is the process which connects source and object code? A translator turns the source code into the object code.

Plenary Explain how the translator program prepares the programmer’s code into a program that the machine can run. Translator program turns source into object. Spots some of the errors in the source code. Wrong (reserved) words Wrong syntax in instruction construction Reports errors to user.

Plenary State the meaning of the following types of testing. White box testing. Testing all possible routes through the program logic/Testing knowing the code/Test the algorithm. Note: not dry run on its own Black box testing. Test that the outcome is as expected for a given input/Testing not knowing the code Alpha testing. Testing by programmer/in-house Beta testing. Testing by public/end users/potential users/unconnected with writing

Plenary State three types of program error and give an example of each. Syntax error Mistyping a reserved word, e.g. typing plint instead of print Logic error A jump instruction that tells the computer to jump to the wrong place Arithmetic error Inappropriate use of arithmetic. Dividing by zero

Plenary Describe the techniques that can be used to help debug a program.

White Box Testing / Dry Runs / Desk Checking The user works through the program instructions manually, keeping track of the values of the variables. Most computer programs require a very large number of instructions to be carried out, so it is usual to only dry run small segments of code that the programmer suspects of harboring an error. Testing knowing the code. Testing specific algorithms within the code. Known as “white box” as testing is done by looking at the code so the program is like a transparent box.

Cross-referencing This software checks the program that has been written and finds places where particular variables have been used. This lets the programmer check to make sure that the same variable has not been used twice for different things.

Traces A trace is where the program is run and the values of all the relevant variables are printed out, as are the individual instructions, as each instruction is executed. In this way, the values can be checked to see where they suddenly change or take on an unexpected value.

Variable dumps At specified parts of the program, the values of all the variables are displayed to enable the user to compare them with the expected results.