CS39N The Beauty and Joy of Computing Lecture #6 : Programming Paradigms 2009-09-28 In response to a 30,000+ signature petition, British PM Gordon Brown.

Slides:



Advertisements
Similar presentations
An Introduction to Programming General Concepts. What is a program? A program is an algorithm expressed in a programming language. programming language.
Advertisements

Computational Models The exam. Models of computation. –The Turing machine. –The Von Neumann machine. –The calculus. –The predicate calculus. Turing.
Adapted from Scott, Chapter 6:: Control Flow Programming Language Pragmatics Michael L. Scott.
Chapter 8 High-Level Programming Languages. 8-2 Chapter Goals Describe the translation process and distinguish between assembly, compilation, interpretation,
Language Paradigms Programming languages. Language paradigms. World view of imperative languages. World view of functional languages. World view.
Comp 205: Comparative Programming Languages Semantics of Imperative Programming Languages denotational semantics operational semantics logical semantics.
CS 101 Course Summary December 5, Big Ideas Abstraction Problem solving Fundamentals of programming.
CS10 The Beauty and Joy of Computing Lecture #1 Welcome; Abstraction At CES 2011 in Vegas, companies showed lots of tablets and internet TV.
CS1001 Lecture 23. Overview Incompleteness and the Halting Problem Incompleteness and the Halting Problem Methods in Artificial Intelligence Methods in.
CS10 The Beauty and Joy of Computing Lecture #5 : Programming Paradigms Intel has shown demos of the game Wolfenstein whose visual images weren’t.
CS10 The Beauty and Joy of Computing Lecture #1 Welcome; Abstraction Watch the student testimonials about CS10, what it means to them, and how.
CS10 The Beauty and Joy of Computing Lecture #5 : Programming Paradigms Times like these make us all appreciate the value of freedom… China.
CS10 The Beauty and Joy of Computing Lecture #23 : Limits of Computing Thanks to the success of the Kinect, researchers all over the world believe.
The Beauty and Joy of Computing Lecture #6 Algorithms Alan Turing ( ) would have turned 100 this year. He was a brilliant British mathematician.
Object Oriented Programming
CS61A Lecture 2 Functions and Applicative Model of Computation Tom Magrino and Jon Kotker UC Berkeley EECS June 19, 2012.
DCT 1123 PROBLEM SOLVING & ALGORITHMS INTRODUCTION TO PROGRAMMING.
Context-Free Languages Regular Languages Violates Pumping Lemma For RLs Violates Pumping Lemma For CFLs Described by CFG, PDA 0n1n0n1n 0n1n2n0n1n2n Described.
Programming Languages
1 Software Development Topic 2 Software Development Languages and Environments.
High-Level Programming Languages: C++
Sadegh Aliakbary Sharif University of Technology Fall 2011.
The Beauty and Joy of Computing Lecture #1 Welcome; Abstraction Watch the student testimonials about the course, what it means to them, and how it has.
COP1220/CGS2423 Introduction to C++/ C for Engineers Professor: Dr. Miguel Alonso Jr. Fall 2008.
Class 37: Uncomputability David Evans University of Virginia cs1120 Halting Problems Hockey Team.
Python Mini-Course University of Oklahoma Department of Psychology Day 2 – Lesson 6 Program Design 4/18/09 Python Mini-Course: Day 2 - Lesson 6 1.
Programming Paradigms Procedural Functional Logic Object-Oriented.
Chapter 1 - Introduction
The Beauty and Joy of Computing Lecture #5 Programming Paradigms Story details the move to Digital of many things precious to us – music, photos, videos.
UC Berkeley EECS Sr Lecturer SOE Dan Garcia printing-aims-to-prevent-a-piracy-plague/ Quest.
Chapter 8 High-Level Programming Languages. 8-2 Chapter Goals Describe the translation process and distinguish between assembly, compilation, interpretation,
The role of data mining in the last presidential election. A mind-blowing piece on how the Obama campaign used various sources of data to target voters.
CS10 The Beauty and Joy of Computing Lecture #1 Welcome; Abstraction The algorithm is rapidly taking over vital functions of businesses, from.
The Beauty and Joy of Computing Lecture #5 Programming Paradigms UC Berkeley EECS Sr Lecturer SOE Dan Garcia invent.citris-uc.org motherboard.vice.com/read/click-print-gun-the-inside-story-of-the-3d-printed-gun-movement-video.
Chapter 12 Computer Programming. Chapter Contents Chapter 12: Computer Programming 2  Section A: Programming Basics  Section B: Procedural Programming.
The Programming Process Define the problem* Make or buy software? Design the program * Code (write) the program Test (debug) the program Document the.
The Beauty and Joy of Computing Lecture #6 Algorithms MIT researchers recently created an algorithm which they say will be able to predict what topics.
The Beauty and Joy of Computing Lecture #10 Social Implications of Computing Online education now has a player in the open access / free education space,
CS 3050 Object-Oriented Analysis and Design. Objectives What is “Object-Oriented?” Object-Oriented Approach Vs. Structured Approach How Has the Object-Oriented.
Salman Marvasti Sharif University of Technology Winter 2015.
The Beauty and Joy of Computing Lecture #6 Algorithms I UC Berkeley EECS Sr Lecturer SOE Dan Garcia.
The Beauty and Joy of Computing Lecture #5 Programming Paradigms invent.citris-uc.org
Algorithm Discovery and Design Objectives: Interpret pseudocode Write pseudocode, using the three types of operations: * sequential (steps in order written)
The Beauty and Joy of Computing Lecture #23 Limits of Computing Researchers at Facebook and the University of Milan found that the avg # of “friends” separating.
In the news: A recently security study suggests that a computer worm that ran rampant several years ago is still running on many machines, including 50%
The Beauty and Joy of Computing Lecture #12 Social Implications of Computing I Online education now has a player in the open access / free education space,
OOPS CONCEPT.  OOPS  Benefits of OOPs  OOPs Principles  Class  Object Objectives.
UC Berkeley EECS Sr Lecturer SOE Dan Garcia printing-aims-to-prevent-a-piracy-plague/ Quest.
The Beauty and Joy of Computing Lecture #1 Welcome; Abstraction Watch the student testimonials about the course, what it means to them, and how it has.
Sadegh Aliakbary Sharif University of Technology Fall 2010.
CPS120: Introduction to Computer Science Lecture 16A Object-Oriented Concepts.
UC Berkeley EECS Lecturer SOE Dan Garcia The success of Apple’s Siri (only available on the iPhone 4S) has sparked competition, to be sure. Google’s IRIS.
서울대한양대 ( 안 산 ) 충남대 1년1년 컴퓨터기초 (C) 컴퓨터프로그래밍 (C, Java) 컴퓨터프로그래밍 (C) 2. 봄 프로그래밍 원리 (Scheme, ML) Structure & Interpretation of Computer Programs 프로그래밍 방법론.
CS10 The Beauty and Joy of Computing Lecture #4 : Functions UC Berkeley EECS Lecturer SOE Dan Garcia Researchers at Microsoft and UW are working.
PROGRAMMING (1) LECTURE # 1 Programming and Languages: Telling the Computer What to Do.
CS10 : The Beauty and Joy of Computing Lecture #5 Programming Paradigms If you visited google.com on Saturday, you saw a tribute to this founding.
UC Berkeley EECS Sr Lecturer SOE Dan Garcia Valve (video game makers of Half-Life) believes the future of video games may not be in the input device (ala.
Object-oriented programming (OOP) is a programming paradigm using "objects" – data structures consisting of data fields and methods together with their.
Mercer Institute for Personal Robots in Education (IPRE)‏ CSC 170 Computing: Science and Creativity.
Programming Paradigms, Software Architectural Patterns, and MVC CS 378 – Mobile Computing for iOS Dr. William C. Bulko.
CS 3723 Programming Languages
Programming paradigms
The Beauty and Joy of Computing Lecture #4 Functions
An Introduction to Programming
Assembler, Compiler, Interpreter
Computer Programming.
High Level Programming Languages
Assembler, Compiler, Interpreter
An Introduction to Programming
Presentation transcript:

CS39N The Beauty and Joy of Computing Lecture #6 : Programming Paradigms In response to a 30,000+ signature petition, British PM Gordon Brown apologized for the way Britain treated Alan Turing (the “father” of computer science, WWII codebreaker) for being gay. So on behalf of the British government, … we’re sorry, you deserved so much better. UC Berkeley Computer Science Lecturer SOE Dan Garcia news.bbc.co.uk/2/hi/technology/ stm

Garcia, Fall 2009 UC Berkeley CS39N “The Beauty and Joy of Computing” : Programming Paradigms (2)  What are they?  Most are Hybrids!  The Four Primary ones  Functional  Imperative  Object-Oriented  OOP Example: Skecthpad  Declarative  Turing Completeness  Summary Programming Paradigms Lecture

Garcia, Fall 2009 UC Berkeley CS39N “The Beauty and Joy of Computing” : Programming Paradigms (3)  “The concepts and abstractions used to represent the elements of a program (e.g., objects, functions, variables, constraints, etc.) and the steps that compose a computation (assignation, evaluation, continuations, data flows, etc.).”  Or, a way to classify the style of programming. What are Programming Paradigms? en.wikipedia.org/wiki/Programming_paradigm

Garcia, Fall 2009 UC Berkeley CS39N “The Beauty and Joy of Computing” : Programming Paradigms (4)  This makes it hard to teach to students, because most languages have facets of several paradigms!  Scratch too!  It’s like giving someone a juice drink(with many fruit in it) and asking to taste just one fruit! Most Languages Are Hybrids!

Garcia, Fall 2009 UC Berkeley CS39N “The Beauty and Joy of Computing” : Programming Paradigms (5)  Computation is the evaluation of math functions  Plugging pipes together  Each pipe, or function, has exactly 1 output  Functions can be input!  Features  No state  E.g., variable assignments  No mutation  E.g., changing variable values  No side effects  Examples  Scheme, Scratch BYOB Functional Programming (review) en.wikipedia.org/wiki/Functional_programming f(x)=(2+3)* x * x f x

Garcia, Fall 2009 UC Berkeley CS39N “The Beauty and Joy of Computing” : Programming Paradigms (6)  AKA “Sequential” Programming  Computation a series of steps  Assignment allowed  Setting variables  Mutation allowed  Changing variables  Like following a recipe. E.g.,  Procedure f(x)  ans = x  ans = ans  ans = (2+3) * ans  return ans  Examples: Pascal, C Imperative Programming en.wikipedia.org/wiki/Imperative_programming f(x)=(2+3)* x

Garcia, Fall 2009 UC Berkeley CS39N “The Beauty and Joy of Computing” : Programming Paradigms (7)  Objects as data structures  With methods you ask of them  These are the behavoirs  With local state, to remember  These are the attributes  Classes & Instances  Instance an example of class  E.g., Fluffy is instance of Dog  Inheritance saves code  Hierarchical classes  E.g., pianist special case of musician, a special case of performer  Examples: Java, C++ Object-Oriented Programming (OOP) en.wikipedia.org/wiki/Object-oriented_programming www3.ntu.edu.sg/home/ehchua/programming /java/images/OOP-Objects.gif

Garcia, Fall 2009 UC Berkeley CS39N “The Beauty and Joy of Computing” : Programming Paradigms (8)  Dr. Ivan Sutherland  “Father of Computer Graphics”  1988 Turing Award (“Nobel prize” for CS)  Wrote Sketchpad for his foundational 1963 thesis  The most impressive software ever written  First…  Object-oriented system  Graphical user interface  non-procedural language OOP Example : SketchPad en.wikipedia.org/wiki/Sketchpad Spent the past few years doing Berkeley in EECS dept!

Garcia, Fall 2009 UC Berkeley CS39N “The Beauty and Joy of Computing” : Programming Paradigms (9)  Express what computation desired without specifying how it carries it out  Often a series of assertions and queries  Feels like magic!  Sub-categories  Logic  Constraint  We saw in Sketchpad!  Examples: Prolog Declarative Programming en.wikipedia.org/wiki/Declarative_programming Anders Hejlsberg “The Future of PDC2008 channel9.msdn.com/pdc2008/TL16/

Garcia, Fall 2009 UC Berkeley CS39N “The Beauty and Joy of Computing” : Programming Paradigms (10)  A Turing Machine has an infinite tape of 1s and 0s and instructions that say whether to move the tape left, right, read, or write it  Can simulate any computer algorithm!  A Universal Turing Machine is one that can simulate a Turing machine on any input  A language is considered Turing Complete if it can simulate a Universal Turing Machine  A way to decide that one programming language or paradigm is just as powerful as another Turing Completeness en.wikipedia.org/wiki/Turing_completeness Turing Machine by Tom Dunne Xkcd comic “Candy Button Paper”

Garcia, Fall 2009 UC Berkeley CS39N “The Beauty and Joy of Computing” : Programming Paradigms (11)  Functional  Evaluate an expression and use the resulting value for something  Imperative  First do this and next do that  Object-oriented  Send messages between objects to simulate the temporal evolution of a set of real world phenomena  Declarative  Answer a question via search for a solution Ways to Remember the Paradigms 03/html/notes/paradigms_themes-paradigm-overview- section.html

Garcia, Fall 2009 UC Berkeley CS39N “The Beauty and Joy of Computing” : Programming Paradigms (12)  Each paradigm has its unique benefits  If a language is Turing complete, it is equally powerful  Paradigms vary in efficiency, scalability, overhead, fun, “how” vs “what” to specify, etc.  Modern languages usually take the best from all  E.g., Scratch  Can be functional  Can be imperative  Can be object-oriented! Summary