ProgrammingLanguages Programming Languages Computational Paradigms.

Slides:



Advertisements
Similar presentations
Methods Java 5.1 A quick overview of methods
Advertisements

An Introduction to Programming General Concepts. What is a program? A program is an algorithm expressed in a programming language. programming language.
Semantics Static semantics Dynamic semantics attribute grammars
Senem Kumova Metin Introduction to Programming CS 115 Introduction to Computing PART I : Computer Basics PART II: Introduction to Computing/Programming.
Programming Languages and Paradigms
Adapted from Scott, Chapter 6:: Control Flow Programming Language Pragmatics Michael L. Scott.
CSCI 330: Programming Language Concepts Instructor: Pranava K. Jha Control Flow-II: Execution Order.
Chapter 8 High-Level Programming Languages. 8-2 Chapter Goals Describe the translation process and distinguish between assembly, compilation, interpretation,
Introduction to Programming Languages Nai-Wei Lin Department of Computer Science and Information Engineering National Chung Cheng University.
Comp 205: Comparative Programming Languages Semantics of Imperative Programming Languages denotational semantics operational semantics logical semantics.
you admittance to the “show”.
Engineering Problem Solving With C++ An Object Based Approach Fundamental Concepts Chapter 1 Engineering Problem Solving.
Functional Design and Programming Lecture 1: Functional modeling, design and programming.
1 Engineering Problem Solving With C++ An Object Based Approach Fundamental Concepts Chapter 1 Engineering Problem Solving.
High-Level Programming Languages
Programming Languages Structure
Chapter 8 High-Level Programming Languages Nell Dale John Lewis.
Visual Basic: An Object Oriented Approach 3 – Making Objects Work.
CSE S. Tanimoto Syntax and Types 1 Representation, Syntax, Paradigms, Types Representation Formal Syntax Paradigms Data Types Type Inference.
Programming Paradigms Imperative programming Functional programming Logic programming Event-driven programming Object-oriented programming A programming.
Microsoft Visual Basic 2012 CHAPTER ONE Introduction to Visual Basic 2012 Programming.
Microsoft Visual Basic 2005 CHAPTER 1 Introduction to Visual Basic 2005 Programming.
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
CSE 341, S. Tanimoto Concepts 1- 1 Programming Language Concepts Formal Syntax Paradigms Data Types Polymorphism.
ProgrammingLanguages Programming Languages Event-Driven Visual Programming Languages This lecture discusses the basic concepts of the event-driven programming.
Computer Architecture Computational Models Ola Flygt V ä xj ö University
Chapter 8 High-Level Programming Languages (modified by Erin Chambers)
Imperative Programming
CS 0004 –Lecture 1 Wednesday, Jan 5 th, 2011 Roxana Gheorghiu.
High-Level Programming Languages: C++
CIS Computer Programming Logic
CS 363 Comparative Programming Languages
Flow of Control. 2 Control Structures Control structure: An instruction that determines the order in which other instructions in a program are executed.
Chapter 1 - Introduction
Principles of Programming Languages Asst. Prof. Dr. Ahmet Sayar Spring-2012 Kocaeli University Computer Engineering Department Introduction.
Computer Concepts 2014 Chapter 12 Computer Programming.
Copyright © 2007 Addison-Wesley. All rights reserved.1-1 Reasons for Studying Concepts of Programming Languages Increased ability to express ideas Improved.
C H A P T E R T E N Event-Driven Programming Programming Languages – Principles and Paradigms by Allen Tucker, Robert Noonan.
CISC 110 Day 1 Hardware, Algorithms, and Programming.
Chapter 8 High-Level Programming Languages. 8-2 Chapter Goals Describe the translation process and distinguish between assembly, compilation, interpretation,
Computer Programs and Programming Languages What are low-level languages and high-level languages? High-level language Low-level language Machine-dependent.
Chapter 12 Computer Programming. Chapter Contents Chapter 12: Computer Programming 2  Section A: Programming Basics  Section B: Procedural Programming.
Theory of Programming Languages Introduction. What is a Programming Language? John von Neumann (1940’s) –Stored program concept –CPU actions determined.
8-1 Compilers Compiler A program that translates a high-level language program into machine code High-level languages provide a richer set of instructions.
Chapter 8 High-Level Programming Languages. 2 Chapter Goals Describe the translation process and distinguish between assembly, compilation, interpretation,
Programming Languages
C H A P T E R T H R E E Type Systems and Semantics Programming Languages – Principles and Paradigms by Allen Tucker, Robert Noonan.
1-1 1 Introduction  Programming linguistics: concepts and paradigms syntax, semantics, and pragmatics language processors.  Historical development of.
Copyright © 2009 Elsevier Chapter 6:: Control Flow Programming Language Pragmatics Michael L. Scott.
Program Design. Simple Program Design, Fourth Edition Chapter 1 2 Objectives In this chapter you will be able to: Describe the steps in the program development.
Review A program is… a set of instructions that tell a computer what to do. Programs can also be called… software. Hardware refers to… the physical components.
Functional Programming
Chapter 10 Programming Fundamentals with JavaScript
Concepts of Programming Languages
Why study programming languages?
Engineering Problem Solving With C An Object Based Approach
PROGRAMMING LANGUAGES
Representation, Syntax, Paradigms, Types
An Introduction to Programming
Chap. 6 :: Control Flow Michael L. Scott.
Chapter 10 Programming Fundamentals with JavaScript
Control Flow Chapter 6.
Chap. 6 :: Control Flow Michael L. Scott.
Representation, Syntax, Paradigms, Types
Principles of Programming Languages
Representation, Syntax, Paradigms, Types
Flow of Control.
An Introduction to Programming
Ch. 1 Vocabulary Alice.
Chapter 15 Functional Programming 6/1/2019.
Presentation transcript:

ProgrammingLanguages Programming Languages

Computational Paradigms

Imperative Programming: In most cases the computer in question was the von Neumann model: a single central processing unit that sequentially executes instructions that operate on values stored in memory.In most cases the computer in question was the von Neumann model: a single central processing unit that sequentially executes instructions that operate on values stored in memory. Programming languages began by imitating and abstracting the operations of a computer.Programming languages began by imitating and abstracting the operations of a computer. A programming language that is characterized by these three properties – the sequential execution of instructions, the use of variables representing memory locations, and the use of assignment to change the values of variables – is called an imperative language.A programming language that is characterized by these three properties – the sequential execution of instructions, the use of variables representing memory locations, and the use of assignment to change the values of variables – is called an imperative language.

The von Neumann Bottleneck The requirement that computation be described as a sequence of instructions, each operating on a single piece of data, is sometimes referred to as the von Neumann bottleneck.The requirement that computation be described as a sequence of instructions, each operating on a single piece of data, is sometimes referred to as the von Neumann bottleneck. Most programming languages are imperative.Most programming languages are imperative. Since it restricts the ability of a language to indicate parallel computation, and non- deterministic computation, or computation that does not depend on order: asynchronousSince it restricts the ability of a language to indicate parallel computation, and non- deterministic computation, or computation that does not depend on order: asynchronous

Functional Programming A functional programming language has as its basic mechanism the evaluation of a function, or the function call.A functional programming language has as its basic mechanism the evaluation of a function, or the function call. The functional paradigm bases the description of computation on the evaluation of functions or the application of functions to known values.The functional paradigm bases the description of computation on the evaluation of functions or the application of functions to known values. The functional paradigm involves no notion of variable or assignment to variables.The functional paradigm involves no notion of variable or assignment to variables. Also, repetitive operations are not expressed by loops but by recursive functions.Also, repetitive operations are not expressed by loops but by recursive functions.

Functional Programming: Lisp & Ada (define (gcd u v) (if (= v 0) u (gcd v (modulo u v)))) (define (gcd u v) (if (= v 0) u (gcd v (modulo u v)))) function gcd (u,v: in integer) return integer is begin if v = 0 then return u; else return gcd(v,u mod v); end if; end gcd;function gcd (u,v: in integer) return integer is begin if v = 0 then return u; else return gcd(v,u mod v); end if; end gcd;

Turing Complete A programming language is Turing complete if it has integer values, arithmetic functions on those values, and if it has a mechanism for defining new functions using existing functions, selection, and recursion.A programming language is Turing complete if it has integer values, arithmetic functions on those values, and if it has a mechanism for defining new functions using existing functions, selection, and recursion. The study of recursive function theory in mathematics has established the following property:The study of recursive function theory in mathematics has established the following property:

Logic Programming In a logic programming 1anguage, a program consists of a set of statements that describe what is true about a desired result.In a logic programming 1anguage, a program consists of a set of statements that describe what is true about a desired result. This language paradigm is based on symbolic logic.This language paradigm is based on symbolic logic. A pure logic programming language has no need for control abstractions such as loops or selection.A pure logic programming language has no need for control abstractions such as loops or selection. For this reason, logic programming is also called declarative programming, since properties are declared, but no execution sequence is specified. logic programming languages are referred to as very-high-level languages.For this reason, logic programming is also called declarative programming, since properties are declared, but no execution sequence is specified. logic programming languages are referred to as very-high-level languages.

Prolog gcd(U,V,U) : – V=0. gcd(U,V,X) : – V > 0, Y is U mod V, gcd(V,Y,X). The gcd of u and v is u if v = 0.The gcd of u and v is u if v = 0. The gcd of u and v is the same as the gcd of v and u mod v if v is > 0.The gcd of u and v is the same as the gcd of v and u mod v if v is > 0.

Object-Oriented Programming It is based on the notion of an object, which can be loosely described as a collection of memory locations together with all the operations that can change the values of these memory locations.It is based on the notion of an object, which can be loosely described as a collection of memory locations together with all the operations that can change the values of these memory locations. Object-oriented programming, not only is a language paradigm, but also is a methodology for software program design.Object-oriented programming, not only is a language paradigm, but also is a methodology for software program design. It represents computation as the interaction among, or communication between, a group of objects, each of which behaves like its own computer, with its own memory and its own operations.It represents computation as the interaction among, or communication between, a group of objects, each of which behaves like its own computer, with its own memory and its own operations.

Object Classes Classes are defined using declarations, much as structured types are declared in a language like CClasses are defined using declarations, much as structured types are declared in a language like C In many object-oriented languages, objects are grouped into classes that represent all the objects with the same properties.In many object-oriented languages, objects are grouped into classes that represent all the objects with the same properties. Objects are then created as particular examples, or instances, of a class.Objects are then created as particular examples, or instances, of a class.

Example in Java public class IntWithGcd; { public IntWithGcd(int val) { value = val;} public int intValue() { return value;} public int gcd ( int v) { int z = value; int y = v; while (y != 0) { int t = x; y = z % y; z = t; } return z; } private int value; }

Example in Java This class can be used by defining an object of the class as follows: IntWithGcd x;This class can be used by defining an object of the class as follows: IntWithGcd x; Then we can ask x to tell us its value by calling the value procedure, as for example, in int y = x.gcd(18);Then we can ask x to tell us its value by calling the value procedure, as for example, in int y = x.gcd(18); we must create, or instantiate, the object with the following statement: x = new IntWithGcd(8);we must create, or instantiate, the object with the following statement: x = new IntWithGcd(8);

Event-Driven Visual Programming All the paradigms we’ve examined are based on a fundamental model of computation in which the program design predetermines what will occur when the program is run.All the paradigms we’ve examined are based on a fundamental model of computation in which the program design predetermines what will occur when the program is run. They are written to run reasonably to any particular sequence of events that may occur once execution begins,They are written to run reasonably to any particular sequence of events that may occur once execution begins, Event-driven programs do not predict the control sequence that will occur;Event-driven programs do not predict the control sequence that will occur; In this model, the input data govern the particular sequence of control that is actually carried out by the program.In this model, the input data govern the particular sequence of control that is actually carried out by the program.

Event-Driven Visual Programming Execution of an event-driven program does not typically terminate; such a program is designed to run for an arbitrary period of time, often indefinitely.Execution of an event-driven program does not typically terminate; such a program is designed to run for an arbitrary period of time, often indefinitely. The most widespread example of an event-driven program is the GUI mouse- and, windows-driven user interface.The most widespread example of an event-driven program is the GUI mouse- and, windows-driven user interface. Event-driven programs also drive web-based applications.Event-driven programs also drive web-based applications.

Event-Driven Visual Programming To provide effective support for event-driven programming, some languages have developed some basic terminology and principles of design.To provide effective support for event-driven programming, some languages have developed some basic terminology and principles of design. Most recently, these principles have appeared in Java, though other languages like Visual Basic also support event-driven programming.Most recently, these principles have appeared in Java, though other languages like Visual Basic also support event-driven programming.