Programming Languages
Lecture 1
Naveen Kumar
The Study of Programming Languages
 The purpose of language is simply that it
must convey meaning (Confucius)
 Whatever ...
What is a programming language?
 A language that is intended for the
expression of computer programs and
 that is capabl...
What is Programming Language
4
ComputerProgram
Programming
Language
Output
use
giveswriteUser
executes
Problem
takes
A short history of programming
Languages
 Early languages:
– Numerically based languages. (FORTRAN:55,ALGOL:58)
– Busines...
Attributes of a good language
 Clarity and simplicity
– Readability
 Naturalness for the application
 Ease of program v...
Programming Methodology
Kind of approach to solve different problems
 How should programs be designed?
 How should progr...
Programming Methodologies Influences
 1950s and early 1960s: Simple applications; worry
about machine efficiency
 Late 1...
Kinds of Programming Methodology
 Unstructured programming
 Procedural/Process oriented programming
– Modular programmin...
Unstructured Programming
 Direct code (step)
Ex: Assembly Language
Adv.
 speed (written in assembly)
Disadv.
 No re-usa...
Procedural oriented Programming
 Top-down approach
 Procedure (Function) are building block
 De-allocation problem (mem...
Procedural oriented Programming
 Adv:
– Re-usability
– Easy to debug
 Disadv:
– Concentrate on what we want to do, not o...
Object-Oriented Programming
Keep large software projects manageable by
human programmers
 Bottom-up approach (user orient...
An Example
 Everything in OOP is grouped as self sustainable
"objects".
 let’s take your “hand” as an example.
– Your bo...
Another Example
 Ex: college (Student, Faculty, Admin)
Student (take course, write exam, view indv. result)
Faculty (set ...
Why OOP?
Modularization
 Decompose problem into smaller
subproblems that can be solved separately.
16
Why OOP?
Abstraction -- Understandability
 Individual modules are understandable by
human readers.
17
Why OOP?
 Encapsulation -- Information Hiding
 Hide complexity from the user of a software.
Protect low-level functional...
Why OOP?
 Composability -- Structured Design
 Interfaces allow to freely combine modules to
produce new systems.
19
Why OOP?
 Hierarchy
 Incremental development from small and
simple to more complex modules.
20
Complexity
increases
Why OOP?
 Continuity
 Changes and maintenance in only a few
modules does not affect the architecture.
21
Main OOP Language Features
 Classes: Modularization, structure.
 Inheritance / extends: Hierarchy of modules,
incrementa...
Upcoming SlideShare
Loading in …5
×

Lec 1 25_jul13

366 views

Published on

Published in: Technology
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
366
On SlideShare
0
From Embeds
0
Number of Embeds
20
Actions
Shares
0
Downloads
2
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

Lec 1 25_jul13

  1. 1. Programming Languages Lecture 1 Naveen Kumar
  2. 2. The Study of Programming Languages  The purpose of language is simply that it must convey meaning (Confucius)  Whatever can be said, can be said clearly (Wittgenstein,1963)  A programming language is a notation for writing programs (Sethi,89) – program is a specification of a computation.2
  3. 3. What is a programming language?  A language that is intended for the expression of computer programs and  that is capable of expressing any computer program 3 Computer program is a specification of a computation.
  4. 4. What is Programming Language 4 ComputerProgram Programming Language Output use giveswriteUser executes Problem takes
  5. 5. A short history of programming Languages  Early languages: – Numerically based languages. (FORTRAN:55,ALGOL:58) – Business languages. (COBOL:60) – Artificial intelligence languages. (LISP,Prolog) – Systems languages. (C:70)  1950 : LISP, FORTRAN, COBOL, ALGOL60, BASIC  1970 : Ada, C, Pascal, Prolog  1980 : C++  1990 : Delphi, Perl  1996 : Java by James Gosling (at SUN Micro Systems)5
  6. 6. Attributes of a good language  Clarity and simplicity – Readability  Naturalness for the application  Ease of program verification – Proof of correctness, test – Simplicity of semantic and syntax  Portability of programs  Cost of use – Program execution – Program translation – Program creation, testing, and use – Program maintenance6
  7. 7. Programming Methodology Kind of approach to solve different problems  How should programs be designed?  How should programs be structured?
  8. 8. Programming Methodologies Influences  1950s and early 1960s: Simple applications; worry about machine efficiency  Late 1960s: People efficiency became important; readability, better control structures – structured programming – top-down design  Late 1970s: Process-oriented (Goal or.) to data-oriented (DB or.) – data abstraction  Middle 1980s: Object-oriented programming – Data abstraction + inheritance + polymorphism
  9. 9. Kinds of Programming Methodology  Unstructured programming  Procedural/Process oriented programming – Modular programming  Object-oriented programming
  10. 10. Unstructured Programming  Direct code (step) Ex: Assembly Language Adv.  speed (written in assembly) Disadv.  No re-usability  Statements written many times  As code increases, complexity increases – Hard to manage large programs – Hard to debug
  11. 11. Procedural oriented Programming  Top-down approach  Procedure (Function) are building block  De-allocation problem (memory leak: memory allocated but not used)  Un- initialized Variables (rand value assigned) Ex: Calculator → scientific → non-scientific → float → int → add. → subs. → mult. → div. Ex: C - language Small functions
  12. 12. Procedural oriented Programming  Adv: – Re-usability – Easy to debug  Disadv: – Concentrate on what we want to do, not on who will use it – Data does not have a owner (sharing) – All functions are global – No data security  Ex: let there are three functions a(),b() and c(). Data d is used by a() and b() but how to restrict from c() [data will be either global or local] – No data integrity [Stack:{push,pop},Queue:{enque, deque}]  How to distinguish which fun associated with which data structure
  13. 13. Object-Oriented Programming Keep large software projects manageable by human programmers  Bottom-up approach (user oriented)  Objects are building block
  14. 14. An Example  Everything in OOP is grouped as self sustainable "objects".  let’s take your “hand” as an example. – Your body has two objects of type hand, named left hand and right hand. Their main functions are controlled/ managed by a set of electrical signals sent through your shoulders – So the shoulder is an interface which your body uses to interact with your hands. – The hand is being re-used to create the left hand and the right hand by slightly changing the properties of it. 14
  15. 15. Another Example  Ex: college (Student, Faculty, Admin) Student (take course, write exam, view indv. result) Faculty (set paper, prepare result, view results) Admin (student admission, staff/faculty selection) 15
  16. 16. Why OOP? Modularization  Decompose problem into smaller subproblems that can be solved separately. 16
  17. 17. Why OOP? Abstraction -- Understandability  Individual modules are understandable by human readers. 17
  18. 18. Why OOP?  Encapsulation -- Information Hiding  Hide complexity from the user of a software. Protect low-level functionality. 18
  19. 19. Why OOP?  Composability -- Structured Design  Interfaces allow to freely combine modules to produce new systems. 19
  20. 20. Why OOP?  Hierarchy  Incremental development from small and simple to more complex modules. 20 Complexity increases
  21. 21. Why OOP?  Continuity  Changes and maintenance in only a few modules does not affect the architecture. 21
  22. 22. Main OOP Language Features  Classes: Modularization, structure.  Inheritance / extends: Hierarchy of modules, incremental development.  Public / Protected / Private: Encapsulation.  Interfaces / Abstract Classes: Composability.  Polymorphism / virtual: Hierarchy of modules, incremental development.  Templates: Type independent abstract data types.22

×