Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
20 views36 pages

Chapter 1 (8) Csc305

The document discusses the importance of studying programming languages, highlighting benefits such as improved expression of ideas, better language selection, and enhanced ability to learn new languages. It provides a brief history of programming languages, their paradigms, and application domains, including scientific computing, business applications, and artificial intelligence. Additionally, it outlines language evaluation criteria and the compilation process involved in translating source code into machine language.

Uploaded by

2023828024
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views36 pages

Chapter 1 (8) Csc305

The document discusses the importance of studying programming languages, highlighting benefits such as improved expression of ideas, better language selection, and enhanced ability to learn new languages. It provides a brief history of programming languages, their paradigms, and application domains, including scientific computing, business applications, and artificial intelligence. Additionally, it outlines language evaluation criteria and the compilation process involved in translating source code into machine language.

Uploaded by

2023828024
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 36

CSC305

PROGRAMMING PARADIGM
1.1
Reasons for Studying Concepts of
Programming Languages

1. Increased capacity to express ideas


• Available features (control structures, data
structures, abstractions, etc.) of a language can limit
how programming concepts/ ideas can be expressed
in that language.
• Awareness of wide variety of programming language
features can reduce such limitations in software
development.
• The study of programming language concepts builds
an appreciation for valuable language features and
encourages programmers to use them.
1.1
Reasons for Studying Concepts of
Programming Languages

2. Improved background for choosing appropriate


languages
• Experience in many languages can help the
programmers to choose more appropriate languages
for new projects.

3. Increased ability to learn new languages


• Programming languages (along with software
development methodologies/ tools) are constantly
evolving.
• Familiarity with fundamental concepts of
programming languages makes it easier to learn new
languages.
1.1
Reasons for Studying Concepts of
Programming Languages

4. Better understanding of the significance of


implementation
• The ability to use the language more intelligently, as
it was designed to be used.
• Become better programmers by understanding the
choices among programming language constructs
and the consequences of those choices.

5. Overall advancement of computing


1.2 A Brief History of
Programming Languages

• The first programming languages


were the machine languages of
the earliest computers, designed
in the 1940’s.
• Several hundred programming
languages and dialects have been
developed since that time.
• Most have had a limited life span
and utility, while a few have
enjoyed widespread success in
one or more application domains.
• Many have played an important
role in influencing the design of
future languages.
Programming Paradigms
1.2 A Brief History of Languages
Machine Language –
Programming Languages 1940’s, the first
programming language
Fortran – late 1950’s Pascal – 1970’s Imperative
Cobol – late 1950’s C – 1970’s
Algol – 1960’s Fortran 77 –
PL/I – 1960’s 1970’s
Modula 2 –
1980’s
– 1980’s
Cobol 85 –
1980’s
Fortran 90 –
1990’s
C++ - 1980’s Eiffel – 1990’s Object-
Smalltalk – 1980’s Java – 1990’s Oriented
Lisp – 1960’s ML – 1970’s Functional
Scheme – 1970’s Haskell – 1990’s
Prolog – 1970’s Logic
CLP – 1980’s
1.2 A Brief History of
Programming Languages

• What’s in a name?
• Here are a few programming language
names and their meanings:
• Ada : named after the woman who is
thought to be the first computer
programmer in the 1800s, Ada Lovelace.
• Algol: short for “Algorithmic Language”,
designed by an international committee in
1959.
• C : designed in the 1970’s primarily to
support the implementation of the Unix
operating system.
• C++ : designed as an extension of C in
the 1980’s to provide new features that
would support object-oriented
programming.
1.2 A Brief History of
Programming Languages

• Cobol : first designed in 1960, Cobol


stands for “Common Business Oriented
Language” and uses English as a basis for
its syntax.
• Fortran : designed by IBM in 1954 for
scientific programming. Fortran is an
abbreviation for “Formula Translator” and
is probably the most widely used
scientific programming language.
• Lisp : short for “List Processor” and
designed in 1960 as a tool for writing
programs for symbol manipulation and list
processing in the field of artificial
intelligence.
• Pascal : is a high-level, general-purpose
programming language developed in
1971.
Programming Languages
• Programming Languages
are designed to
communicate ideas about
algorithms between people
and computers.

Programming Paradigm
• Programming paradigm is
the way of representing
algorithmic expressions to
support computing
applications for certain
application domain. The
programming paradigms
1.3 Introduction to are developed by the
programming communities
Language Paradigms in their own application
area.
Imperative Programming
• The program is a series
of steps, each of which
performs a calculation,
retrieves input, or
produces output.
Procedural abstraction
is an essential building
block for imperative
programming, as are
assignments, loops,
sequences, and
conditional statements.
Major imperative
programming languages
1.3 Introduction to are Cobol, Fortran,
Language Paradigms Pascal, C, and C++.
Object-Oriented
Programming
• The program is a
collection of objects
that interact with each
other by passing
messages that
transform their state.
Object modeling,
classification, and
inheritance are
fundamental building
blocks for Object-
oriented programming.
Major object-oriented
1.3 Introduction to languages are
Smalltalk, Java, C++,
Language Paradigms and Eiffel.
Functional Programming
• The program is a
collection of
mathematical
functions, each with an
input (domain) and a
result (range).
Functions interact and
combine with each
other using functional
composition,
conditionals, and
recursion. Major
functional
programming
languages are Lisp,
Scheme, Haskell, and
1.3 Introduction to ML.
Language Paradigms
Logic Programming
• The program is a
collection of logical
declarations about
what outcome a
function should
accomplish rather
than how that
outcome should be
accomplished.
Execution of the
program applies these
declarations to
achieve a series of
possible solutions to a
problem. The major
logic programming
1.3 Introduction to language is Prolog.

Language Paradigms
Event-Driven
Programming
• The program is a
continuous loop that
responds to events
that are generated in
an unpredictable
order. These events
originate from user
actions on the screen
(mouse clicks, key
stroke etc.). Major
event-driven
programming
languages include
Visual Basic and Java.
1.3 Introduction to
Language Paradigms
Concurrent
Programming/ Parallel
Programming
• The program is a
collection of
cooperating
processes, sharing
information with
each other from time
to time. Concurrent
programming
languages include SR
and High-
Performance Fortran.
1.3 Introduction to
Language Paradigms
• Some programming
languages are
intentionally designed
to support more than
one paradigm.
• For examples:
• C++ is an imperative and
object-oriented
language.
• Java supports object-
oriented and event-
driven paradigms.
• The experimental
language Leda is
designed to support the
imperative, object-
1.3 Introduction to oriented, functional,
and logic programming
Language Paradigms paradigms.
1.4 Application Domains/
Programming Domains

• The programming
communities that
represent distinct
application domains can
be grouped in the
following way:
1.4 Application Domains/
Programming Domains
Scientific Computing
• Scientific programming is
primarily concerned with making
complex calculations very fast and
very accurately.
• They are primarily implemented
using the imperative
programming paradigm. The most
common data structures are
arrays and matrices.
• The parallel programming
languages are used for scientific
application like weather systems
or ocean flow. Modern scientific
programming languages include
Fortran 90, C, and High-
Performance Fortran.
1.4 Application Domains/
Programming Domains
Business Applications
• The systems include an
organization’s payroll system,
accounting system, online
sales and marketing systems,
inventory and manufacturing
systems, and etc.
• Traditionally, business
application systems have
been developed in
programming languages like
Cobol, RPG and SQL.
• The online ordering systems
are developed using event-
driven languages like Java
and Tcl/Tk.
1.4 Application Domains/
Programming Domains
Artificial Intelligence
• This programming community is
concerned about developing
programs that model human
intelligent behavior, logical
deduction, and cognition.
• The paradigms of functional
programming and logic
programming have evolved
largely through the efforts of
artificial intelligence
programmers.
• Functional programming
languages - Lisp, Scheme,
Haskell and ML. Logic
programming languages -
Prolog and CLP.
1.4 Application Domains/
Programming Domains
Systems Programming
• Systems programmers are
those who design and maintain
the basic software that runs
the systems – operating system
components, network
software, programming
language compilers and
debuggers, virtual machines
and interpreters, and so on.
• The paradigms that are used
include imperative, parallel,
and event-driven. About 95
percent of the code of the Unix
system is written in C language.
1.4 Application Domains/
Programming Domains
Web Software
• The most dynamic area of new
programming community
growth is the World Wide Web
– for electronic commerce,
government, industry,
academic etc.
• The programming paradigms
that are used are object-
oriented and event-driven.
Programming languages that
support web applications
include Perl, Tcl/Tk, JavaScript,
PHP, ASP and etc.
1.5 Language
Evaluation Criteria
1.5 Language Evaluation
Criteria
Readability
• One of the most important criteria
for judging a programming language
is the ease with which programs can
be read and understood.
• Readability must be considered in
the context of problem domain. For
example, if a program that describes
a computation is written in a
language not designed for such use,
the program may be unnatural,
making it difficult to read.
• The characteristics that contribute
to the readability of a programming
languages are overall simplicity,
orthogonality, control statements,
data types and structures, and
syntax considerations.
1.5 Language Evaluation
Criteria
1.5 Language Evaluation
Criteria
1.5 Language
Evaluation Criteria
1.5 Language Evaluation
Criteria
1.6 Compilation
Process

• The language that


compiler translates is
called the source
language. The
process of
compilation and
program execution
takes place in several
phases, the most
important of which
are shown in Figure
1.1.
1.6 Compilation
Process
• The lexical analyzer gathers
the characters of the source
program into lexical units. The
lexical units of a program are
identifiers, special words,
operators, and punctuation
symbols.
• The lexical analyzer ignores
comments in the source
program, because the
compiler has no use for them.
• The syntax analyzer takes the
lexical units from the lexical
analyzer and uses them to
construct hierarchical
structures called parse trees.
These parse trees represent
the syntactic structure of the
program.
1.6 Compilation
Process
• The intermediate code
generator produces a program
in a different language, at an
intermediate level between the
source program and the final
output of the compiler, the
machine language program.
• Intermediate languages
sometimes look very much like
assembly languages and in fact
sometimes are actually
assembly languages.
1.6 Compilation
Process
1.6 Compilation
Process
1.6 Compilation
Process
• Although the machine language
generated by a compiler can be
executed directly on the hardware,
it must nearly always be run along
with some other code.
• Most user programs also require
programs from the operating
system. Among the most common
of these are programs for input and
output.
• Before the machine language
programs produced by a compiler
can be executed, the required
programs from the operating
system must be found and linked to
the user program.
• The process of collecting system
programs and linking them to user
programs is called linking and
loading, or sometimes just linking.
It is accomplished by a system
programs program called a linker.

You might also like