1. Course code: CS213
Course title :
(Programming Languages Concepts)
PART: 1
Prof. Taymoor Mohamed Nazmy
Dept. of computer science, faculty of computer science, Ain Shams uni.
Ex-vice dean of post graduate studies and research Cairo, Egypt
1
2. What is the meaning of
Programming Languages Concepts?
• 5 and 2 are bigger
• (syntax no semantics) it is the job of compiler or the interpreter for every programming
language
• What is the result of adding 2 and 5 ?
• (syntax and semantics), (natural language)
• Add 2 to 5
• ( type of abstraction )
• X= 2+5
• (Another type of abstraction , and variable declaration, data type, expression, specify how
the problem can be solved, imperative programming)
• Repeat a set of statements with different input every time
• (Type of programming based on objects, it is called object oriented programming
language, )
• If two students are absent , is all the students are attended?
• ( This is type of none numerical operations, it is logical programming, another type of
programming, programming paradigm. 2
3. About the lecturer
- Prof. of computer science since 2006,
- Director of Ain Shams information network,
- Vice dean of post graduate studies and research,
- Vice dean of environmental and social affairs,
- Member in editorial board of many Int. journals,
- Member in Scientific committee of many int. conferences
- Executive chair of int. conf. on information and intelligent systems,
- Published more than 60 scientific papers in int. journals and
conference,
Supervised more than 20 master and Ph. D thesis.
3
5. About the course
• The materials of this course were collected from many resources, include the
reference book, other books, online courses, presentations, and web sites.
• There are many details will be given to simplify topics in this course, however at
the end of the course the most important topics will be highlighted.
• The delivered materials through this presentation is your main resource,
• This presentation will be delivered to you.
• There will be 2 term exams 40% + 20 % assignment
• The final exam 40%
•
• The exam will include subjective and objective questions,
5
6. Assignment
• Prepare a report on learning,
• implementation, and applications of
• MATLAB or
• GNU OCTAVE
• in computer science
• 20-30 page in papers and CD
• To be delivered in the 10th week
6
7. Week 1 : Preface
Week 2 : Introduction and Evolution of
the major programming languages
Week 3 : Describing syntax and semantics
Week 4 : Imperative languages
Week 5 : Functional programming languages
Week 6 : Logic programming languages
Week 7 : Names, binding, type checking, and scope
7
Course Description
8. Week 8 : Object-oriented languages, OOP languages
Week 9 : Data types
Week 10 : Expressions and assignment statements
Week 11 : Statement level control structure
Week 12 : Subprograms and implementing subprograms
Week 13: Abstract data type, and Concurrency
8
Course Description
9. Textbook
• Robert W. Sebesta,
• Concepts of programming language,
• Addison Wesley.
9
10. Course Objectives
Describe the evolution of programming languages from machine
language to high-level languages.
Understand how a program in a high-level language is translated
into machine language.
Distinguish between four computer language paradigms.
Understand the procedural paradigm and the interaction
between a program unit and data items in the paradigm.
Define functional paradigm and understand its applications.
Define a declaration naming binding and and scope on PL
Understand the object-oriented paradigm and the interaction
between a program unit and objects in this paradigm.
• 10
11. Free online site for learning
many programming languages
• https://www.tutorialspoint.com/tutorialslibrary.htmt
• Computer science portal
• https://www.geeksforgeeks.org/
11
12. How to be prepared for this course
• You need to be learned more than programming language.
• You are not going to learn a new language here.
• It is theoretical course.
• Try to catch as many as you can of the PL names and
features.
• Be ready for a lot of slides to be presented here.
12
13. • The knowledge you gain here it will
help you to learn more programming
languages in easier way.
13
15. Introduction
There are a tremendously large number of
programming languages, so large that it is
impractical to study them all.
So focusing on programming concepts and the
techniques to use them, not on programming
languages, will help us to select the proper
language to solve our problems.
15
16. Introduction
• The concepts are organized in terms of
computation models (Programming paradigms).
• The number of different computation models
that are known to be useful is much smaller than
the number of programming languages.
16
17. What is a programming language?
A tool for instructing machines
A notation for algorithms
A means for communication among programmers
A means for controlling computerized devices
Is a notational system for describing computation in a
machine-readable and human-readable form
All of the above!
And more
17
17
18. • Preprocessor: resolve the statements that start with #, e.g. header file
inclusion, macro substitution etc.
• Compiler: convert the code into a binary executable format. First the
preprocessor is invoked by the compiler before starting the
compilation.
• Linker: before the compiler convert the code into executable, the
linker provides the linkage for those function calls that are defined
in other compiled units like library functions printf, scanf, cin, cout
etc. It needs to be invoked separately if the called functions are not
part of standard library.
• Loader: once the code is converted to executable binary, we try to
run it. This time the loader comes into action, it loads the binary
code into memory for execution. It's an OS module.
Building a program
18
20. Definition of a Paradigm
Paradigm: is commonly used to refer to a category
of entities that share a common characteristic.
It is a model of something
Paradigms are the way that we think about
problems
Abstraction: it means ignore irrelevant detail in a
safe way.
20
21. Programming paradigm
• Programming paradigm is a model for a class of
programming languages that share a set of
common characteristics.
– Some languages are designed to support one particular
paradigm, examples:
• Smalltalk supports object-oriented programming
• Haskell supports functional programming
– Other programming languages support multiple
paradigms:
–
• Object Pascal, C++, C#, Visual Basic, Common Lisp,
Scheme, Perl, Python, Ruby, Oz and F#. 21
22. Early Models of Computation
Kleene, Church, Turing, Post, 1930’s (before computers!!)
Turing Machines – Turing, 1940’s (defined: computable)
RAM Machines – von Neumann, 1940’s (“real computer”)
Cellular Automata – von Neumann, 1950’s
Finite-state machines, pushdown automata, various people, 1950’s
VLSI models – 1970s ( integrated circuits made of thousands of
transistors form a single chip)
Parallel RAMs, etc. – 1980’s
22
23. Processing Paradigms
• A programming paradigm can be
understood as an abstraction of a
computer system, who is based on a
certain processing model or paradigm.
• Nowadays, the prevalent computer
processing model used is the von
Neumann model, invented by John von
Neumann in 1945, influenced by Alan
Turing’s “Turing machine”.
23
John von Nuemann
Von Neumann Architecture
26. The first higher-level language
Short Code (1949)
• Short Code was the first higher-level language ever developed
and used for a computer.
• Short Code was designed in 1949 by John Mauchly, co-
inventor of UNIVAC I, the first commercial computer
produced in the United States.
Joey Paquet, 2010-2013 26Comparative Study of Programming Languages
John Mauchly
UNIVAC
26
27. • The first programmable computers required
the programmers to write explicit instructions
to directly manipulate the hardware of the
computer.
• This “machine language” was very tedious to
write by hand since even simple tasks such as
printing some output on the screen require 10
or 20 machine language commands.
27
28. • Machine language is often referred to as a
“low level language” since the code directly
manipulates the hardware of the computer.
• (Remember that the essence of the hardware components are
mainly buses and the logic gates.)
• By contrast, higher level languages such as
“C”, C++, Pascal, Cobol, Fortran, ADA and
Java are called “compiled languages”.
28
29. • In a compiled language, the programmer
writes more general instructions and
a compiler (a special piece of software)
automatically translates these high level
instructions into machine language.
• The machine language is then executed by the
computer. A large portion of software in use
today is programmed in this fashion.
29
30. A-0 (1951)
• The A-0 system, written
by Grace Hopper in
1951 and 1952 for the
UNIVAC I, was the first
compiler system ever
developed for a computer.
Joey Paquet, 2010-2013 30Comparative Study of Programming Languages
Grace Hopper and UNIVAC
30
31. The major types of software that
developed by one of programming languages
Application software
Hardware
System software
System Software
Operating Systems
Schedules computer events
Allocates computer resources
Monitor events
Application Software
User
s
Language translators
Interpreters
Compilers
Utility programs
Routine operations
(e.g. sort, list, print)
Manage data
(e.g. create files, merge files
31
32. Programs and Programming
Programs
A set of
statements
written in a
Programming
Language and
arranged in a
specified
structure.
Executable
Non-executable
Machine
Assembly
High level
Main programs
Sub-programs
101100 10110011 10111010
ADD A B
A + B
Operation
code
Operand
32
33. Executable
statements
Non-executable
statement
Declarations (definitions)
• Data type declarations
o integer data type.
o Floating point data type.
o Character data type.
• Variable declarations
• Constant declarations
• Program type declarations
o Main program
o Subprogram
Perform
• Arithmetic operations
• Logical operations
• Transfer execution control operations
• Cause iteration
• Data movement operations
o Input devices to memory
o Memory to output devices
o Memory to memory
o Memory to register
o Register to memory
33
34. What makes a language successful?
• Expressive power
– Easy to express things, to use once fluent (C, APL, Algol-68, Perl)
• Ease of use for novice
– Easy to learn (BASIC, Pascal, LOGO)
• Ease of implementation
– BASIC, Forth
• Standardization
– C, Java
• Open source
– Wide dissemination without cost (Pascal, Java)
• Excellent compilers
– Possible to compile to very good (fast/small) code (Fortran)
• Patronage
– Backing of a powerful sponsor (COBOL, PL/1, Ada, Visual Basic)
34
35. slide 35
What Do They Have in Common?
• Lexical structure and analysis
– Tokens: keywords, operators, symbols, variables
– Regular expressions and finite automata
• Syntactic structure and analysis
– Parsing, context-free grammars
– lexical analysis reads the source code one character at a time and converts it
into meaningful lexemes (tokens) whereas syntax analysis takes those tokens
and produce a parse tree as an output.
• Pragmatic issues
– Scoping, block structure, local variables
– Procedures, parameter passing, iteration, recursion
– Type checking, data structures
• Semantics
– What do programs mean and are they correct
40. /* This program reads two integer numbers from the
keyboard and prints their product.
*/
#include <iostream.h>
int main (void)
{
// Local Declarations
int number1;
int number2;
int result;
// Statements
cin >> number1;
cin >> number2;
result = number1 * number2;
cout << result;
return 0;
} // main
Program in C++ language
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
40
42. Early programming languages
42
Classic C
Simula
Pascal
Algol68
BCPL
Fortran
Lisp
COBOL
Algol60
PL/I
1950s: 1960s: 1970s:
Red==major commercial use
Yellow==will produce important “offspring”
43. Modern programming languages
43
Object Pascal
C++
Java95
C#Ada98
C++98
Java04
C++11
Python
Lisp
Smalltalk
Fortran77
Ada
Eiffel
Simula67
COBOL89
PHP
C89
Pascal
PERL
Visual Basic
COBOL04 Javascript
48. The total number of programming languages in world is between hundreds of programming
languages with thousands more in our periphery.. But there is no exactly number
• A# .NET
• A# (Axiom)
• A-0 System
• A+
• A++
• ABAP
• ABC
• ABC ALGOL
• ABSET
• ABSYS
• ACC
• Accent
• Ace DASL (Distributed Application
Specification Language)
• ACL2
• ACT-III
• Action!
• ActionScript
• Actor
• Ada
• Adenine
• Agda
• Agilent VEE
• Agora
• AIMMS
• Aldor
• Alef
• ALF
• ALGOL 58
• ALGOL 60
• ALGOL 68
• ALGOL W
• Alice
• Alma-0
• AmbientTalk
• Amiga E
• AMOS
• AMPL
• AngelScript
• Apex
48
50. How choose programming language?
– C vs. Modula-3 vs. C++ for systems programming
– Fortran vs. APL vs. Ada for numerical computations
– Ada vs. Modula-2 for embedded systems
– Common Lisp vs. Scheme vs. ML for symbolic data
manipulation
– Java vs. C/CORBA for networked PC programs
50
51. Language Example program
“C” #include <stdio.h> void main() { printf("Hello World"); }
C++ #include <iostream> int main() { cout << "Hello World"; return 0; }
Pascal program helloworld (output); begin writeln('Hello World'); end.
Oracle
PL/SQL
CREATE OR REPLACE PROCEDURE helloworld AS BEGIN
DBMS_OUTPUT.PUT_LINE('Hello World'); END;
Java class helloworld { public static void main (String args []) { System.out.println ("Hello World"); } }
Perl #!/usr/local/bin/perl -w print "Hello World";
Basic print "Hello World"
EX: the “Hello World” example for compare different languages
to print “Hello World” on the computer screen.
51
52. 1.52
FORTRAN
PROGRAM HELLO
DO 10, I=1,10
PRINT *,'Hello World'
10 CONTINUE
STOP
END
BEGIN
FILE F (KIND=REMOTE);
EBCDIC ARRAY E [0:11];
REPLACE E BY "HELLO WORLD!";
WHILE TRUE DO
BEGIN
WRITE (F, *, E);
END;
END.
ALGOL
HELLO: PROCEDURE OPTIONS (MAIN);
/* A PROGRAM TO OUTPUT HELLO WORLD */
FLAG = 0;
LOOP: DO WHILE (FLAG = 0);
PUT SKIP DATA('HELLO WORLD!');
END LOOP;
END HELLO;
PL/1
54. Language development domains
Numerically based languages
Computing mathematical expressions
FORTRAN, Algol, Pascal, PL/1, BASIC, C, C++
Business languages
COBOL (Common Business Oriented Language)
English-like notation
54
55. Language development
Artificial intelligence languages
Tree search; Rule-based paradigm
LISP (LISt Processing)
PROLOG (PROgramming in LOGic)
System languages
C, C++
Script languages: AWK, Perl, TCL/TK
Web programming: HTML, XML, Java,
Microsoft *.NET family 55
56. Web programming languages that used by
the most popular websites
56
Website
Client-side programming
language
Server-side programming
language(s)
Facebook JavaScript
Hack, PHP , Python, C++,
Java, Erlang, D, XHP,
Haskell
YouTube JavaScript C, C++, Python, Java, Go
Yahoo JavaScript PHP
Amazon JavaScript Java, C++, Perl
.
57. 1.57
How do Programming Languages Differ?
Common Constructs:
> basic data types (numbers, etc.); variables; expressions;
statements; keywords; control constructs; procedures;
comments; errors ...
Uncommon Constructs:
> type declarations; special types (strings, arrays, matrices, ...);
sequential execution; concurrency constructs;
packages/modules; objects; general functions,
57
59. 1-59
Reasons for Studying Concepts of
Programming Languages
• Increased ability to express ideas
• Improved background for choosing appropriate languages
• Increased ability to learn new languages
• Better understanding of significance of implementation
• Better use of languages that are already known
• Overall advancement of computing
60. 1-60
Language Evaluation Criteria
• Readability: the ease with which programs
can be read and understood
• Writability: the ease with which a language
can be used to create programs
• Reliability: conformance to specifications (i.e.,
performs to its specifications)
• Cost: the ultimate total cost
61. 1-61
Evaluation Criteria: Readability
• Overall simplicity
– A manageable set of features and constructs
– Minimal feature multiplicity
– Minimal operator overloading, in which a single operator symbol has
more than one meaning.
• Orthogonality
– A relatively small set of primitive constructs can be combined in a
relatively small number of ways
– Every possible combination is legal
• Data types
– Adequate predefined data types
• Syntax considerations
– Identifier forms: flexible composition
– Special words and methods of forming compound statements
– Form and meaning: self-descriptive constructs, meaningful keywords
62. Evaluation Criteria: Writability
• Simplicity and orthogonality
– Few constructs, a small number of primitives, a small set of rules
for combining them
• Support for abstraction
– The ability to define and use complex structures or operations in
ways that allow details to be ignored
• Expressivity
– A set of relatively convenient ways of specifying operations
– Strength and number of operators and predefined functions
62
63. Evaluation Criteria: Reliability
• Type checking
– Testing for type errors
• Exception handling
– Intercept run-time errors and take corrective measures
• Aliasing
– Presence of two or more distinct referencing methods for the same memory
location
63
64. 1-64
Evaluation Criteria: Cost
• Training programmers to use the language
• Writing programs (closeness to particular applications)
• Compiling programs
• Executing programs
• Language implementation system: availability of free compilers
• Reliability: poor reliability leads to high costs
• Maintaining programs
65. 1-65
Evaluation Criteria: Others
• Portability
– The ease with which programs can be moved from one
implementation to another
• Generality
– The applicability to a wide range of applications
• Well-definedness
– The completeness and precision of the language’s
official definition
66. Programming languages paradigms
1) Imperative: Programming with an explicit sequence of commands that update
state.
2) Declarative: Programming by specifying the result you want, not how to get it.
3) Structured: Programming with clean, goto-free, nested control structures.
4) Procedural: Imperative programming with procedure calls.
5) Functional (Applicative): Programming with function calls that avoid any global
state.
6) Function-Level (Combinator): Programming with no variables at all.
7) Object-Oriented: Programming by defining objects that send messages to each
other.
8) Event-Driven: Programming with emitters and listeners of asynchronous actions.
9) Flow-Driven: Programming processes communicating with each other over predefined
channels.
10) Logic (Rule-based): Programming by specifying a set of facts and rules. An engine
infers the answers to questions.
11) Constraint: Programming by specifying a set of constraints. An engine finds the values
that meet the constraints.
12) Aspect-Oriented: Programming cross-cutting concerns applied transparently.
13) Reflective: Programming by manipulating the program elements themselves.
14) Array: Programming with powerful array operators that usually make loops
unnecessary.
66
69. • “imperative” programming means that the
computer get a list of commands and
executes them in order, when “procedural
programming” (which is also imperative)
allows splitting those instructions into
procedures (or functions or modular).
• By default Object Oriented Programming is in
a way an extension of procedural programming
as it allows grouping functions around a
specific entities named “classes” and is also
imperative.
69
74. Types of programming languages Translators
These programs convert High Level Language
Source code into machine code (binary)
Assemblers
Interpreter
Translates and executes one line at a time
Compiler
Translates and executes the entire program at once
This program can then be ran repeatedly
74
75. Translators - 3 types
Source program Translator Object program
Execution
assembly
language
programs
high-level
language
programs
machine
codes
assembler
compiler
interpreter
The functions of the three types of translators
75
77. Assembler
• Assembly language is converted into executable
• machine code by a utility program referred to as
an assembler.
• An assembler creates object code by translating
assembly language instructions into object codes.
77
79. 79
• Any compiler must perform two major tasks
– Analysis of the source program
– Synthesis of a machine-language program
The Structure of a Compiler (1)
Compiler
Analysis Synthesis
80. The Structure of a Compiler (2)
80
Scanner Parser
Semantic
Routines
Code
Generator
Optimizer
Source
Program Tokens Syntactic
Structure
Symbol and
Attribute
Tables
(Used by all Phases of The Compiler)
(Character Stream)
Intermediate
Representation
Target machine code
81. Interpreters
• Interpreters translate source code into machine
language while a program is running, one line at a time,
unlike compiler, which processes everything at once.
• In this case a single line is executed at a time. It is time
consuming.
• Examples of Programming Languages Using
• Interpreter :
• • Lisp
• • BASIC
81
82. 82
The Concept of Interpretation
An interpreter is a simple program. It does not translate the source
code into machine code. In fact, it reads the source code program line
by line and executes it . Therefore, an interpreter is also called a
program execution environment.
The Interpreter
83.
84. Bytecode Languages
• Bytecode languages are a type of programming language
that fall under the categories of both compiled and
interpreted languages because they employ both
compilation and interpretation to execute code.
• Java and the .Net framework are easily the most common
examples of bytecode languages (dubbed Common
Intermediate Language in .Net).
• In fact, the Java Virtual Machine (JVM) is such a common
virtual machine to interpret bytecode that several languages
have implementations built to run on the JVM.
84
86. Evolution of the major
programming languages
from past and present
86
87. Evolution of the Major Programming Languages
• The IBM 704 and Fortran
• Functional Programming: Lisp
• The First Step Toward Sophistication: Algol 60
• Computerizing Business Records: COBOL
• The Beginnings of Timesharing: BASIC
• Everything for Everybody: PL/I
• Two Early Dynamic Languages: APL and SNOBOL
• The Beginnings of Data Abstraction: SIMULA 67
• Orthogonal Design: ALGOL 68
• Some Early Descendants of the ALGOLs
87
87
88. Evolution of the Major Programming Languages
• Programming Based on Logic: Prolog
• History’s Largest Design Effort: Ada
• Object-Oriented Programming: Smalltalk
• Combining Imperative and Object-Oriented Programming: C++
• An Imperative-Based Object-Oriented Language: Java
• Scripting Languages for the Web
• A C-Based Language for the New Millennium: C#
• Markup/Programming Hybrid Languages
88
88
90. Fortran
• IBM Mathematical Formula Translating System, later
popularly know as Fortran.
• Originally developed by a team lead by John Backus
at IBM in the 1950s for scientific and engineering
applications on the IBM704, introduced in 1954.
• General-purpose, procedural, imperative
programming language that is especially suited to
numeric computation and scientific computing.
90
John Backus
• Originally designed to improve on the economics of programming, as
programming using low level languages had become to be more costly
than the time it actually saved.
91. Fortran
• Fortran 0 (1954):
– assignment, if, goto, do loop, formatted/unformatted I/O, pause, stop, continue,
notion of basic block (entry/exit point)
• Fortran I (1955-1957)
– First implemented compiler
• Fortran II (1958):
– procedural programming, pass by reference, return statement, independent
compilation of subroutines
• Fortran IV (1961-62):
– machine-independence, boolean expressions, logical operations, explicit type
declarations, subroutines as parameters.
• Fortran 66 (1966):
– first standard, based on Fortran IV
91
92. Fortran
• Fortran 77 (1977-78):
– Fixed problems in Fortran 66, string handling. Historically most important
dialect.
• Fortran 90 (1991-92):
– Includes many features of modern programming languages: recursion,
modules, generic procedures, operator overloading, abstract data types,
dynamic memory allocation, dynamic data structures, case statement. Also
removed many obsolescent features/constructs.
• Fortran 95 (1995):
– minor revisions, but most notably included many features of High Performance
Fortran, a data-parallel version of Fortran.
• Fortran 2003 (2003):
– Major revision. object-orientation, constructors, finalizers, asynchronous I/O,
procedures pointers, interoperability with C, enhanced modularity features.
• Fortran 2008 (2010):
– Minor upgrade vs Fortran 2003, added more constructs for parallel execution.
92
93. BASIC
Next
Designed for use as simple, interactive problem-solving
language
Beginner’s All-purpose Symbolic Instruction Code
93
94. COBOL
Next
COmmon Business-Oriented Language
It is imperative, procedural and, since 2002, object-
oriented. COBOL is primarily used in business,
finance, and administrative systems for companies and
governments. COBOL is still widely used in legacy
applications deployed on mainframe computers, such
as large-scale batch and transaction processing jobs.
But due to its declining popularity and the retirement
of experienced COBOL programmers, programs are
being migrated to new platforms. Most programming
in COBOL is now purely to maintain existing
applications. 94
95. The ALGOL Family: Structured
Abstractions and Machine Independence
• ALGOL: ALGOrithmic Language released in
1960
– Provided a standard notation for computer scientists
to publish algorithms in journals
– Included structured control statements for sequencing
(begin-end blocks), loops (for loop), and selection (if
and if-else statements)
– Supported different numeric types
– Introduced the array structure
– Supported procedures, including recursive procedures
95
96. The ALGOL Family (cont’d.)
• ALGOL achieved machine independence with the
requirement for an ALGOL compiler with each
type of hardware
• Compiler: translates programming language
statements into machine code
• ALGOL was the first language to receive a formal
specification or definition
– Included a grammar that defined its features for both
programmers and for compiler writers
96
97. The ALGOL Family (cont’d.)
• Large number of high-level languages
descended from ALGOL, including:
– Pascal: language for teaching programming in the
1970s
– Ada: for embedded applications of U.S. Dept. of
Defense
97
98. 2-98
Smalltalk - 1972-1980
• Developed at Xerox PARC, initially by
Alan Kay, later by Adele Goldberg
• First full implementation of an object-
oriented language (data abstraction,
inheritance, and dynamic type binding)
• Pioneered the graphical user interface
everyone now uses
99. C
• The C programming language was designed by
Dennis Ritchie at Bell Laboratories in the early
1970s
• Influenced by
– ALGOL 60 (1960),
– CPL (Cambridge, 1963),
– BCPL (Martin Richard, 1967),
– B (Ken Thompson, 1970)
• Traditionally used for systems programming,
though this may be changing in favor of C++
99
100. Elements of a C Program
• A C development environment includes
– System libraries and headers: a set of standard libraries and their
header files. For example see /usr/include and glibc.
– Application Source: application source and header files
– Compiler: converts source to object code for a specific platform
– Linker: resolves external references and produces the executable
module
• User program structure
– there must be one main function where execution begins when the
program is run. This function is called main
• int main (void) { ... },
• int main (int argc, char *argv[]) { ... }
• UNIX Systems have a 3rd way to define main(), though it is not POSIX.1
compliant
int main (int argc, char *argv[], char *envp[])
– additional local and external functions and variables
100
101. C++
• C++ is a statically typed, multi-paradigm, compiled,
general-purpose programming language.
• It is a middle-level language, as it comprises a
combination of both high-level and low-level
language features.
• It was developed by Bjarne Stroustrup starting in
1979 at Bell Laboratories as an enhancement to the C
programming language following the object-oriented
principles pioneered by Simula.
• Goals:
– Augment C with the notion of classes and inheritance
– Keep the same performance as C
– Keep same applicability as C
101
Bjarne Strousroup
102. 102
The C# Programming Language
• C# was developed as an object-oriented and component-
oriented language
• It exists as part of the Visual Studio .NET package
• C# (like Java) is modeled after the C++ programming
language
• Pointers are not used in C#
• C# does NOT require the use of object destructors, forward
declarations, or #include files
• It has the ability to pass by reference
• Multiple inheritance is not allowed in C#
104. Java
• Java is a programming language originally
developed by James Gosling at Sun
Microsystems and released in 1995 as a
core component of Sun Microsystems'
Java platform.
104
James Gosling
• Java is a general-purpose, concurrent, class-based, and object-oriented, and
is specifically designed to have as few implementation dependencies as
possible.
• It is intended to let application developers "write once, run anywhere“,
meaning that once it has been compiled, it can be executed on any platform.
105. Java
• Eventually, Java was not used for its original purpose.
• Java can develop applications such as:
• Mobile Applications: ... Embedded Systems: ... Web Applications: ... Web
Servers and Application Servers: ... Enterprise Applications: ... Scientific
Applications.
• Since it started to be used for this purpose, the use of Java increased
faster than that of any other programming language.
• It is now used to develop applications for a wide variety of domains and
platforms, and is used as a language of choice to teach programming by
many institutions.
105
106. Java
• Java applications are compiled to bytecode that can be interpreted on any
Java Virtual Machine (JVM) regardless of computer architecture.
• Due to interpretation, Java programs were initially 10 times slower than
their C++ counterparts.
• However, Java programs' execution speed improved significantly with the
introduction of Just-in-time compilation in 1997/1998 for Java 1.1, the
addition of language features supporting better code analysis, and
optimizations in the Java Virtual Machine itself, such as HotSpot becoming
the default for Sun's JVM in 2000.
• Since these optimizations were put in place, Java programs became as
efficient as their C++ counterparts.
106
107. Javascript
• Javascript is completely different from
java.Alongside HTML and CSS, JavaScript is one
of the three core technologies of the World Wide
Web.
• JavaScript enables interactive web pages and thus
is an essential part of web applications. The vast
majority of websites use it,[ and all major web
browsers have a dedicated JavaScript engine to
execute it
107
108. Erlang
• Erlang is a programming language used to build
massively scalable soft real-time systems with
requirements on high availability. Some of its
uses are in telecoms, banking, e-commerce,
computer telephony and instant messaging.
• Erlang's runtime system has built-in support for
concurrency, distribution and fault tolerance.
108
109. Paython
• Paython supports multiple programming paradigms, including object-
oriented, imperative, functional and procedural, and has a large and
comprehensive standard library.
• Python interpreters are available for many operating systems. Python, is
open source software. Python and CPython are managed by the non-profit
Python Software Foundation.
• Python is a clear and powerful object-oriented programming language,
comparable to Perl, Ruby, Scheme, or Java.
• Runs anywhere, including Mac OS X, Windows, Linux, and Unix, also
available for Android and iOS.
• It can be used in: Web Development- Data Science — including machine
learning, data analysis, and data visualization- Scripting
109
110. Perl
• Perl is a programming language specially designed for text editing.
It is now widely used for a variety of.
• The most popular use of Perl is in Web development., Perl is also
used to automate many tasks in the Web servers, and other
administration jobs, it can automatically generate emails and clean
up systems.
• Perl is still used for its original purpose i.e. extracting data and
generating reports.
• It can produce reports on resource use and check for security issues
in a network. Due to this reason, Perl has become a popular
language used in web development, networking and bioinformatics
too. Apart from all this perl can also be used for CGI programming.
110
111. Ruby
• Ruby is an interpreted scripting language which means
most of its implementations execute instructions directly
and freely, without previously compiling a program into
machine-language instructions.
• It was designed and developed in the mid-1990s by
Yukihiro "Matz" Matsumoto in Japan.
• Ruby supports multiple programming paradigms, including
procedural, object-oriented, and functional programming.
According to the creator, Ruby was influenced by Perl,
Smalltalk, Eiffel, Ada, Basic, and Lisp
111
112. ASP
• Active Server Pages (ASP), later known as Classic
ASP or ASP Classic, is Microsoft's first server-side
script engine for dynamically generated web pages.
ASP.NET, first released in January 2002.
• ASP uses server-side scripting to generate content that
is sent to the client's web browser.
• The ASP interpreter reads and executes all script code
between <% and %> tags, the result of which is content
generation. These scripts were written using VBScript,
JScript, or PerlScript.
112
113. PHP
• PHP: Hypertext Preprocessor (or simply PHP) is a server-side
scripting language designed for Web development.
• PHP code may be embedded into HTML code, or it can be used in
combination with various web template systems, web content
management systems, and web frameworks. PHP code is usually
processed by a PHP interpreter implemented as a module in the web
server or as a Common Gateway Interface (CGI) executable.
• PHP is mainly focused on server-side scripting, so you can do
anything any other CGI program can do, such as collect form data,
generate dynamic page content, or send and receive cookies. But
PHP can do much more.
113
115. Hack
• Hack is the new language behind Facebook,
which is still the most popular social network
to date. It’s a web programming language
invented and (recently) open-sourced by
Facebook.
• The company claims that the language helps
programmers to code programs faster and
avoid errors early and easily.
115
116. SQL
• SQL is a nonprocedural language used in
programming and designed for managing data
held in a relational database management system
(RDBMS), or for stream processing in a relational
data stream management system (RDSMS).
• It is particularly useful in handling structured data
where there are relations between different
entities/variables of the data.
116
117. Objective-C
• Objective-C is the primary programming
language you use when writing software for OS X
and iOS.
• It’s a superset of the C programming language
and provides object-oriented capabilities and a
dynamic runtime. Objective-C inherits the syntax,
primitive types, and flow control statements of C
and adds syntax for defining classes and methods.
117
118. SWIFT
• Swift is a general-purpose, multi-paradigm,
compiled programming language created for
iOS, OS X, watchOS, tvOS and Linux
development by Apple Inc.
• Swift was introduced at Apple's 2014
118
119. R
• R is a language and environment for statistical
computing and graphics.
• R provides a wide variety of statistical (linear
and nonlinear modelling, classical statistical
tests, time-series analysis, classification,
clustering, …) and graphical techniques, and is
highly extensible.
119
120. Scientific Computing with
MATLAB
– It was marketed and further developed under MathWorks Inc.
(founded in 1984) – www.mathworks.com
– Matlab is a software package which can be used to perform
analysis and solve mathematical and engineering problems, as well
as implementation of many algorithm in computer science fields.
– It has excellent programming features and graphics capability –
easy to learn and flexible.
– Available in many operating systems – Windows, Macintosh,
Unix, DOS
– It has several tooboxes to solve specific problems.
120
121. What is Matlab?
Matlab is basically a high level
language which has many
specialized toolboxes for making
things easier for us
How high?
Assembly
High Level
Languages such as
C, Pascal etc.
Matlab
121
122. What is MATLAB?
• Integrated software environment
– Computation
– Visualization
– Easy-to-use environment
• High-level language
– Data types
– Functions
– Control flow statements
– Input/output
– Graphics
– Object-oriented programming capabilities
122
123. Toolboxes
• Collections of functions to solve problems from
several application fields.
– DSP (Digital Signal Processing) Toolbox
– Image Toolbox
– Wavelet Toolbox
– Neural Network Toolbox
– Fuzzy Logic Toolbox
– Control Toolbox
– Multibody Simulation Toolbox
– And many others…
123
124. Matlab Screen
Command Window
type commands
Current Directory
View folders and m-files
Workspace
View program variables
Double click on a variable
to see it in the Array Editor
Command History
view past commands
save a whole session
using diary
124
125. • What is a visual programming language?
Programmer writes
and implements
program in segments
Visual programming
environment (VPE)
allows developers to
drag and drop objects
to build programs
125
A visual programming language enables the development of software programs by
eliminating textual software code with a series of visual graphics elements.
VPL incorporates these graphical elements as the primary context of the language
arranged in a systematic order.
The graphics or icons included within a visual program serve as input, activities,
connections and/or output of the program.
126. Program Development Tools
• What is Visual Basic for Applications (VBA)?
Macro programming language
Macro—series of statements used to automate tasks
126
127. Program Development Tools
• What is an application generator?
Program that creates source code or machine code from specification
Consists of report writer, form, and menu generator
Form provides areas for entering data
127
128. Web Programming
• When it comes to making a website or app coding involves
basically three types of languages i.e the programming
language, Scripting Language and Markup Language.
• Web programming can be briefly categorized into client and
server coding. The client side needs programming related to
accessing data from users and providing information. It also
needs to ensure there are enough plug ins to enrich user
experience in a graphic user interface.
• There are certain tools/platforms that aid in both client- and
server-side programming. Some examples of these are Opa
and Tersus.
128
129. • To improve user experience and related functionalities
on the client side, JavaScript is usually used. It is an
excellent client-side platform for designing and
implementing Web applications.
• HTML5 and CSS3 supports most of the client-side
functionality provided by other application frameworks.
• The server side needs programming mostly related to
data retrieval, security and performance. Some of the
tools used here include ASP, Lotus Notes, PHP, Java
and MySQL.
129
131. Web Page Development
• What is HTML (Hypertext Markup Language)?
Used to create Web pages
131
132. Web Page Development
•How are special effects and interactive elements
added to a Web page?
Counter
tracks
number of
visitors to
Web site
Image map
graphic
image that
points to
URL
Script
interpreted
program that
runs on client
Applet
usually runs
on client, but
is compiled
Processing
form
collects data
from visitors
to Web site
Servlet
applet that
runs on
server
ActiveX
control
small program
that runs on
client
132
133. Web Page Development
• What is the common gateway interface (CGI)?
Communications standard that defines how Web server communicates with
outside sources
Step 3. When the user submits a
request, it is sent to the CGI program.
The CGI program contacts the
database and requests information for
the user.
Step 1. The
programmer stores
the CGI program in
a special folder on
the Web server such
as /cgi-bin.
Step 2. The Webmaster creates a
link between the CGI program and
Web page. When a user displays the
Web page, the CGI program
automatically starts.
Step 4. The CGI
program receives
information from the
database, assembles
it in an HTML
format, and sends it
to the user’s Web
browser.
Database
CGI script—program that manages sending and receiving across CGI
133
134. Web Page Development
• What is dynamic HTML (DHTML)?
Allows developers to
include more graphical
interest and interactivity
in Web page
134
135. Web Page Development
• What are XHTML, XML, and WML?
Next
XHTML
(Extensible HTML)
enables Web sites to be displayed
more easily on microbrowsers
XML
(Extensible Markup Language)
allows developers to
create customized tags
WML
(Wireless Markup Language)
allows developers to design pages
specifically for microbrowsers
Includes features of HTML
and XML
Uses wireless
application protocol (WAP),
standard that specifies
how wireless devices
communicate with Web
Server sends entire record to
client, enabling client to do
much of processing without
going back to server
135
137. Integrated development environment (IDE)
• Most high-level languages now include an
Integrated Development Environment (IDE)
consisting of a simple word processor,
compiler, linker and loader tools for finding
errors.
• This software package provides menus from
which user can select the next step.
• It leaves all versions of the program in
memory. For safety, we need to explicitly save
the source file to disk.
137