INTRODUCTION TO
PROGRAMMING
WHAT IS A PROGRAM?
• An organized list of instructions that, when executed ,causes the computer to
behave in a predetermined manner.
• A program is like a recipe. It contains a list of ingredients (called variables) and a
list of directions called statements that tell the computer what to do with
variables. The variables can represent numeric data ,text, or graphical images
• There are many programming languages like –C,C++,Java,Python,VB & C#.
These are all high level programming languages.
WHY STUDY PROGRAMMING LANGUAGES
• Increased capacity to express ideas
• Improved background for choosing appropriate languages
• Increased ability to learn new languages
• Better understanding of the implementation of concepts
• Increased ability to design new languages
Categories of Programming Languages
• Programming languages fall into two fundamental categories low and high
level languages.
• Low level languages are machine dependent; that is, they are designed to be
run on a particular computer
• High level languages are machine independent and can be run on a variety of
computers
Programming Environments
• Collection of tools used in the development of software
• Consist of a file system , a text editor , a linker , a compiler ,a debbuger and
development tools
• Helps to increase productivity and quality
• Examples: Borland C++,Visual C++,Visual J++
Characteristics of Programming Language
Readability
A good high level language will allow programs to be written in some ways that
resemble a quite English description of the underlying algorithms. If care is
taken , the coding may be done in a way that is essentially self-documenting.
Portability
High level languages ,being essentially machine independent ,should be able to
develop portable software's
Generality
Most high level languages allow the writing of a wide variety of programs , thus
relieving the programmer of the need to become an expert in many diverse
languages .
Brevity
Language should have the ability to implement the algorithm with less amount
of code. Programs expresses in high level languages are often considerably
shorter than their low level equivalents.
Error checking
Being human, a programmer is likely to make many mistakes in the
development of a computer program. Many high level languages enforce a great
deal of error checking both at compile-time and at run-time
Cost
The ultimate cost of a programming language is a function of many of its
characteristics .
Familiar Notation
A language should have a familiar notation , so it can be understood by most of
the programmers.
Quick Translation
It should admit quick translation
Efficiency
It should permit the generation of efficient object code
Modularity
It is desirable that programs can be developed in the language as a collection of
separately compiled modules ,with appropriate mechanisms for ensuring self
consistency between these modules
Widely available
Language should be widely available and it should be possible to provide
translators for all the major machines and for all the major operating systems.
LANGUAGE EVALUATION
CRITERIA
• Readability
• Writability
• Reliability
• Cost
Readability
• The ease with which programs can be read and understood
• Simplicity-A language that has a large number of basic components is more
difficult to learn than the one with small number of basic components
• Orthogonality-In programming language means that relatively small set of
primitive constructs can be combined in a relatively small number of ways to
build the control and data structures of the languages.
• Orthogonal is closely related to simplicity
• The more orthogonal the design of a language is ,the fewer exceptions the
language rules requires.
Writability
• Is a measure of how easily a language can be used to create programs for a
chosen domain.
• Writability Simplicity and Orthogonality
• Support for Abstraction-Abstraction means the ability to define and then use
complicated structures or operations in ways that allows many of the details
to be ignored.
Reliability
• Reliability type checking
Type checking is simply testing for type errors in a given program, either by the
compiler or during program execution Exception Handling Aliasing Readability
and Writability
Cost
• The ultimate total cost of a programming language is a function of many of
its characteristics.
• Cost of training programmers
• Cost of writing programs in the language
• Cost of compiling programs
• Cost of executing programs
• Cost of compilers
GENERATION OF LANGUAGES
• 1GL or the first generation language was(and still is )machine language or
high level of instruction and data that the processor is given to work
on(which on conventional computers is a string of 0s and 1s).
• 2GL or second generation language is assembler (sometimes called
“assembly”) language. A typical 2GL instruction looks like this:ADD
An assembler converts the assembler language statements into machine
language
• 3GL or third generation language is a high level programming language such as
JAVA,C++ statements looks lie this.
public Boolean handleEvent(Event evt){switch(evt.id){
case Event.ACTION_EVENT:{
If(“Try me”.equal(evt.arg)){
A compiler converts the statements of a specific high level programming language
into machine language .
4GL or Fourth generation language is designed to be closer to natural language than a
3GL language. A 3GL requires a considerable amount of programming knowledge
EXTRACT ALL CUSTOMERS WHERE”PREVIOUS PURCHASES”TOTAL
MORE THAN $1000
• 5GL or the fifth generation language is a programming that uses a visual or
graphical development interface to create source language that is usually
compiled with 3GL or 4GL language compiler
WHAT IS A TRANSLATOR
• A translator is a programming language processor that converts a computer
program from language to another.
• It takes a program written in source code and converts into machine code.
• It discovers and identifies the error during translation
COMPILER,ASSEMBLER & INTERPRETER
• A Compiler is program that converts high level language to assembly
language.
• Similarly, an assembler is a program that converts the assembly language to
machine level language
• Assembler is used to translate the program written in Assembly language into
machine code. An assembler performs the translation process in similar way
as compiler .but assembler is the translator program for low level
programming languages ,while a compiler is the translator program for high
level programming languages.
PROGRAMMING DOMAINS
• Scientific Applications
• Business Applications
• Artificial Intelligence(AI)
• Systems Programming Languages
• Very high level languages (VHLLs)
• Special Purpose Languages
SCIENTIFIC APPLIACTION
• Scientific applications have simple data structures but require large numbers
of floating point arithmetic computations. For some scientific applications
where efficiency is the primary concern, like those that were common in the
1950’s and 1960’s ,no subsequent language is significantly better than
FORTRAN
BUSINESS APPLICATION
• The use of computers for business applications began in the 1950’s.The first
Successful high-level language for business was COBOL which appeared in 1960.
COBOL business languages are characterized ,according to the needs of the
application , by elaborate input and output facilities and decimal data types.
With the advent of microcomputers came new ways of business , especially small
business, to use computers.
Two specific tools, spreadsheet systems and database systems were developed for
business and are widely used.
Artificial Intelligence
• AI is a broad area of computer applications characterized by the absence of
exact algorithms and the use of symbolic computations rather than numeric
computation.
• Symbolic computation means that symbols, consisting of names rather than
numbers are manipulated
Systems Programming Languages
• The operating system and all of the programming support tools of a
computer system are collectively known as its systems software.
• Systems software is used almost continuously and therefore must have
execution efficiency
• A language for this domain must have low level features that allow the
software to external devices to be written.
Evolution of programming languages -1940’s
• 1940's: machine level – use binary or equivalent notations for actual numeric
values •
• 1950's: "assembly language" – names for instructions: ADD instead of
0110101, etc. – names for locations: assembler keeps track of where things
are in memory; translates this more humane language into machine language
– this is the level used in the "toy" machine – needs total rewrite if moved to
a different kind of CPU
Evolution of programming languages-1960’s
• "high level" languages -- Fortran, Cobol, Basic –
• writen in a more natural notation, e.g., mathematical formulas – a program
("compiler", "translator") converts into assembler – potential disadvantage:
lower efficiency in use of machine – enormous advantages: accessible to
much wider population of users portable: same program can be translated for
different machines more efficient in programmer time
Evolution of programming languages-1970’s
• “System programming" languages -- C – efficient and expressive enough to
take on any programming task writing assemblers, compilers, operating
systems – a program ("compiler", "translator") converts into assembler –
enormous advantages: accessible to much wider population of programmers
portable: same program can be translated for different machines faster,
cheaper hardware helps make this happen
Evolution of programming 1980’s
• "object-oriented" languages: C++ – better control of structure of really large
programs better internal checks, organization, safety – a program
("compiler", "translator") converts into assembler or C – enormous
advantages: portable: same program can be translated for different machines
faster, cheaper hardware helps make this happen
THANK YOU!!!