Lec 1 25_jul13
Upcoming SlideShare
Loading in...5

Lec 1 25_jul13






Total Views
Views on SlideShare
Embed Views



1 Embed 17

http://www.palak.pw 17



Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
Post Comment
Edit your comment

Lec 1 25_jul13 Lec 1 25_jul13 Presentation Transcript

  • Programming Languages Lecture 1 Naveen Kumar
  • 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
  • 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.
  • 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) – 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
  • 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
  • Programming Methodology Kind of approach to solve different problems  How should programs be designed?  How should programs be structured?
  • 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
  • Kinds of Programming Methodology  Unstructured programming  Procedural/Process oriented programming – Modular programming  Object-oriented programming
  • 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
  • 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
  • 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
  • Object-Oriented Programming Keep large software projects manageable by human programmers  Bottom-up approach (user oriented)  Objects are building block
  • 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
  • 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
  • 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 functionality. 18
  • 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, incremental development.  Public / Protected / Private: Encapsulation.  Interfaces / Abstract Classes: Composability.  Polymorphism / virtual: Hierarchy of modules, incremental development.  Templates: Type independent abstract data types.22