The Beauty and Joy of Computing Lecture #5 Programming Paradigms invent.citris-uc.org

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

Software Development Languages and Environments. Programming languages High level languages are problem orientated contain many English words are easier.
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.
Programming Paradigms Introduction. 6/15/2005 Copyright 2005, by the authors of these slides, and Ateneo de Manila University. All rights reserved. L1:
Chapter 8 High-Level Programming Languages. 8-2 Chapter Goals Describe the translation process and distinguish between assembly, compilation, interpretation,
CS10 The Beauty and Joy of Computing Lecture #1 Welcome; Abstraction At CES 2011 in Vegas, companies showed lots of tablets and internet TV.
Computers: Tools for an Information Age
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 #5 : Programming Paradigms Times like these make us all appreciate the value of freedom… China.
CS39N The Beauty and Joy of Computing Lecture #6 : Programming Paradigms In response to a 30,000+ signature petition, British PM Gordon Brown.
Programming Paradigms Imperative programming Functional programming Logic programming Event-driven programming Object-oriented programming A programming.
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
New experiences with teaching Java as a second programming language Ioan Jurca “Politehnica” University of Timisoara/Romania
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.
Computer Architecture Computational Models Ola Flygt V ä xj ö University
High-Level Programming Languages: C++
O BJECT O RIENTATION F UNDAMENTALS Prepared by: Gunjan Chhabra.
ProgrammingLanguages Programming Languages Computational Paradigms.
COP1220/CGS2423 Introduction to C++/ C for Engineers Professor: Dr. Miguel Alonso Jr. Fall 2008.
Invitation to Computer Science, Java Version, Second Edition.
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.
11 Chapter 11 Object-Oriented Databases Database Systems: Design, Implementation, and Management 4th Edition Peter Rob & Carlos Coronel.
Computer Concepts 2014 Chapter 12 Computer Programming.
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.
Problem Solving Techniques. Compiler n Is a computer program whose purpose is to take a description of a desired program coded in a programming language.
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.
An Object-Oriented Approach to Programming Logic and Design Chapter 1 An Overview of Computers and Logic.
Code Design Using Functions CSE 1310 – Introduction to Computers and Programming Vassilis Athitsos University of Texas at Arlington 1.
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.
CS 3050 Object-Oriented Analysis and Design. Objectives What is “Object-Oriented?” Object-Oriented Approach Vs. Structured Approach How Has the Object-Oriented.
Data Structures and Algorithms Dr. Tehseen Zia Assistant Professor Dept. Computer Science and IT University of Sargodha Lecture 1.
Data Structures Using C++ 2E
90-723: Data Structures and Algorithms for Information Processing Copyright © 1999, Carnegie Mellon. All Rights Reserved. 1 Lecture 1: Introduction Data.
The Beauty and Joy of Computing Lecture #6 Algorithms I UC Berkeley EECS Sr Lecturer SOE Dan Garcia.
Copyright © 2006 The McGraw-Hill Companies, Inc. Programming Languages 2nd edition Tucker and Noonan Chapter 1 Overview A good programming language is.
Algorithm Discovery and Design Objectives: Interpret pseudocode Write pseudocode, using the three types of operations: * sequential (steps in order written)
Objective You will be able to define the basic concepts of object-oriented programming with emphasis on objects and classes by taking notes, seeing examples,
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.
Welcome to OBJECT ORIENTED PROGRAMMING Prepared By Prepared By : VINAY ALEXANDER PGT(CS) KV jhagrakhand.
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.
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 Languages 2nd edition Tucker and Noonan
Functional Programming
Programming paradigms
The Beauty and Joy of Computing Lecture #4 Functions
An Introduction to Programming
Computer Programming.
Introduction to Data Structures
Language Basics.
High Level Programming Languages
An Introduction to Programming
Basic Concepts of Algorithm
Presentation transcript:

The Beauty and Joy of Computing Lecture #5 Programming Paradigms invent.citris-uc.org It provides prototyping resources such as 3D printing, laser cutting, soldering stations, hand and power tools. We are opening the lab to a limited number of students, staff & faculty to work on outside projects. The public is getting a broader glimpse at the still-secretive world of government data collection. UC Berkeley EECS Lecturer Gerald Friedland

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

UC Berkeley “The Beauty and Joy of Computing” : Programming Paradigms (3) Friedland  “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

UC Berkeley “The Beauty and Joy of Computing” : Programming Paradigms (4) Friedland a) 1 (functional) b) 1 (not functional) c) 2 d) 3 e) 4 Of 4 paradigms, how many can Snap! be? snap.berkeley.edu

UC Berkeley “The Beauty and Joy of Computing” : Programming Paradigms (5) Friedland  This makes it hard to teach to students, because most languages have facets of several paradigms!  Called “Multi-paradigm” languages  Snap! 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!

UC Berkeley “The Beauty and Joy of Computing” : Programming Paradigms (6) Friedland  Computation is the evaluation of 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 (though not pure)  Scheme, Haskell  Scratch BYOB Functional Programming (review) en.wikipedia.org/wiki/Functional_programming f(x)=(x+3)* x + x 3 * x f x

UC Berkeley “The Beauty and Joy of Computing” : Programming Paradigms (7) Friedland  “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 = (x+3) * ans  return ans  Examples: Pascal, C Imperative Programming en.wikipedia.org/wiki/Imperative_programming f(x)=(x+3)* x

UC Berkeley “The Beauty and Joy of Computing” : Programming Paradigms (8) Friedland  Objects as data structures  With methods you ask of them  These are the behaviors  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 (tho not pure)  Java, C++ Object-Oriented Programming (OOP) en.wikipedia.org/wiki/Object-oriented_programming www3.ntu.edu.sg/home/ehchua/programming/jav a/images/OOP-Objects.gif

UC Berkeley “The Beauty and Joy of Computing” : Programming Paradigms (9) Friedland  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!

UC Berkeley “The Beauty and Joy of Computing” : Programming Paradigms (10) Friedland OOP in BYOB

UC Berkeley “The Beauty and Joy of Computing” : Programming Paradigms (11) Friedland  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!  Example: Prolog Declarative Programming en.wikipedia.org/wiki/Declarative_programming Anders Hejlsberg “The Future of PDC2008 channel9.msdn.com/pdc2008/TL16/

UC Berkeley “The Beauty and Joy of Computing” : Programming Paradigms (12) Friedland  Five schoolgirls sat for an examination. Their parents – so they thought – showed an undue degree of interest in the result. They therefore agreed that, in writing home about the examination, each girl should make one true statement and one untrue one. The following are the relevant passages from their letters:  Betty  Kitty was 2 nd  I was 3 rd  Ethel  I was on top  Joan was 2 nd  Joan  I was 3 rd  Ethel was last  Kitty  I came out 2 nd  Mary was only 4 th  Mary  I was 4 th  Betty was 1 st Declarative Programming Example

UC Berkeley “The Beauty and Joy of Computing” : Programming Paradigms (13) Friedland a) Functional b) Imperative c) OOP d) Declarative e) All equally powerful Of 4 paradigms, what’s the most powerful?

UC Berkeley “The Beauty and Joy of Computing” : Programming Paradigms (14) Friedland  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 ironphoenix.org/tril/tm/ Turing Machine by Tom Dunne Xkcd comic “Candy Button Paper”

UC Berkeley “The Beauty and Joy of Computing” : Programming Paradigms (15) Friedland  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 en.wikipedia.org/wiki/Programming_paradigm

UC Berkeley “The Beauty and Joy of Computing” : Programming Paradigms (16) Friedland  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., Snap!  Can be functional  Can be imperative  Can be object-oriented  Can be declarative Summary