Lecture 10 CS 101
Lecture 10 CS 101
Lecture 10 CS 101
1. Debug
2. Testing
3. Interpreter
4. Compiler
5. Assembler
6. History of programing languages
Debugging
To debug a program or hardware device is to start with a problem, isolate the source
of the problem, and then fix it.
Process of identifying, isolating and correcting the errors Two
Categories –
Syntax errors -- Errors in spelling and grammar.
You can use the compiler or interpreter to uncover syntax errors.
You must have a good working knowledge of error messages to discover the cause
of the error.
Example: C line -> printf(“Hello!”)
Logical errors -- Errors that indicate the logic used when coding the program failed to
solve the problem.
You do not get error messages with logic errors.
Your only clue to the existence of logic errors is the production of wrong
solutions.
Testing
Checking of desired results
Generate Test cases
Objective is to find a case where program fails
Two Types –
Black Box (Functional) –
This is a method of software testing that examines the functionality
of an software or program (e.g. what the software does) without
peering into its internal structures or workings.
White Box (Glass Box) –
This a method of testing software that tests internal structures or
workings of an application
In white-box testing an internal perspective of the system, as
well as programming skills, are used to design test cases.
System Software:
System Software includes the Operating System and all the
utilities that enable the computer to function.
Example:
Operating Systems, Compiler, Loader, Linker, Interpreter.
System Software:
Operating System:
An operating system (OS) is software that manages computer
hardware and software resources and provides common
services for computer programs.
The operating system is an essential component of the system
software in a computer system. Application programs usually
require an operating system to function.
OS acts as an interface between the application programs
and the machine hardware.
Object File
Linker
Executable file
C library file
System Software (contd):
•
Interpreter: An interpreter is a computer program that translates and
executes instructions written in a computer programming language
line-by- line, unit by unit etc.,
• An interpreter needs to be able to analyze instructions written in the
source language.
• Assembler
• Converts assembly language programs into object files
Object file and Executable file
•An object file is a file containing object code, meaning relocatable format machine code
that is usually not directly executable.
•Object file has .o extension e.g. hello.o
•Object files are produced by an assembler, compiler, or other language translator, and used
as input to the linker, which in turn typically generates an executable file.
•An executable file is formed by linking the Object files and has .exe extension.
•Object file contains low level instructions which can be understood by the CPU. That is
why it is also called machine code.
Difference between Object file and Executable file :
Both are binary files but the differences between those are:-
1)we can execute an executable file while we cannot execute an object file.
2)An object file is a file where compiler has not yet linked to the libraries, so you get an
object file just before linking to the libraries, so still some of the symbols or function
definitions are not yet resolved which are actually present in the libraries, and that's why
we cannot execute it.
Difference between Interpreter and Compiler
Interpreter Compiler
1. Translates program one Scans the entire program and translates it
statement at a time. as a whole into machine code.
special registers.
•As it is closer to plain English, it is easier to read and write when
compared to machine code.
Drawbacks:
•Code cannot be ported to other systems and has to be rewritten
because each processor has their own mnemonics.
•No Symbolic names for memory locations. You need to keep track
of the exact memory location that a piece of data is stored. That is,
you must manipulate memory locations directly.
Third generation (High Level Languages)
•Even though Assembly code is easier to read than machine code, it is still
not straightforward to perform loops and conditionals .
•This means that one line of third generation code can produce many lines of
object (machine) code, saving a lot of time when writing programs.
FORTRAN –
•Stands for FORmula TRANslator is developed in 1957 by John Backus
•Very easy to handle complex numbers
•Syntax was very difficult to remember
BASIC –
• Stands for Beginner’s All purpose Symbolic Instruction Code developed in 1960
• This language use interpreter during execution of program
• Execution slower than FORTRAN programs
COBOL –
•Stands for COmmon Business Oriented Language developed in 1960
•Revised version in 1974 and then 1984 etc.
•First language to use English like statement in programming syntax
PASCAL –
• Named after Blaise Pascal (Philosopher) in 1970
• Specially designed as teaching language
• Structured programming language
• Platform independent language
Third generation (High Level Languages)
C
•Developed in 1972 at AT & T’s Bell Laboratory by Dennis Ritchie called
POP
• Reliable and Simple language
• Powerful language which is used for system programming
• Handling of Data types, pointers, variables and file etc. is provided
C++
•Developed in 1979 by Bjarne Stroustrup called as C with Class and C++ in
1983
• Extension of C, supports object oriented features and Case sensitive
•Specially works on Classes and Objects
JAVA –
•Developed in 1991 by Sun Microsystem called as Oak
• In 1995, changes to JAVA
• Supports object oriented features
• Simple and Easy to learn
• Safe and Secure
2 language
• Portable and Platform Independent
Third generation (High Level Languages)
Examples: C, C++,Java.
BASIC (Beginners All Purpose Symbolic Instruction Code),
FORTRAN (Formula Translation).
PL/I (Programming Language, Version 1).
ALGOL (Algorithmic Language).
APL (A Programming Language).
•Advantages:
1.Hardware independence, can be easily ported to other systems and
processors
2.Time saving, programmer friendly, one line of 3rd gen is the equivalent of
many lines of 1st and 2nd gen.
•Disadvantages:
Code produced might not make the best use of processor specific
features unlike 1st and 2nd gen
Fourth generation
•The fourth generation programming language or non-procedural language,
often abbreviated as 4GL, enables users to access data in a database.
•These are very high-level programming languages are often referred to as
goal-oriented programming languages because they are usually limited to a
very specific application and it might use syntax that is never used in other
programming languages.
•SQL, NOMAD and FOCUS are examples of fourth generation programming
languages.
Fifth generation
Disadvantages:
Programs run slower than those of earlier language generations because their
machine code is longer and more complex
References / Resources