Mercer Institute for Personal Robots in Education (IPRE)‏ CSC 170 Computing: Science and Creativity.

Slides:



Advertisements
Similar presentations
Chapter 8 High-Level Programming Languages. 8-2 Chapter Goals Describe the translation process and distinguish between assembly, compilation, interpretation,
Advertisements

OOP - Object Oriented Programming Object Oriented Programming is an approach to programming that was developed to make large programs easier to manage.
Algorithms and Problem Solving-1 Algorithms and Problem Solving.
Algorithms and Problem Solving. Learn about problem solving skills Explore the algorithmic approach for problem solving Learn about algorithm development.
CS 101 Course Summary December 5, Big Ideas Abstraction Problem solving Fundamentals of programming.
CS10 The Beauty and Joy of Computing Lecture #5 : Programming Paradigms Intel has shown demos of the game Wolfenstein whose visual images weren’t.
Chapter 8 High-Level Programming Languages Nell Dale John Lewis.
CS10 The Beauty and Joy of Computing Lecture #5 : Programming Paradigms Times like these make us all appreciate the value of freedom… China.
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
Chapter 2: Developing a Program Extended and Concise Prelude to Programming Concepts and Design Copyright © 2003 Scott/Jones, Inc.. All rights reserved.
CS39N The Beauty and Joy of Computing Lecture #6 : Programming Paradigms In response to a 30,000+ signature petition, British PM Gordon Brown.
C++ fundamentals.
Programming Paradigms Imperative programming Functional programming Logic programming Event-driven programming Object-oriented programming A programming.
 Computer Science 1MD3 Introduction to Programming Michael Liut Ming Quan Fu Brandon.
Introduction To System Analysis and design
Chapter 1: Introduction to Visual Basic.NET: Background and Perspective Visual Basic.NET Programming: From Problem Analysis to Program Design.
1 Software Development Topic 2 Software Development Languages and Environments.
High-Level Programming Languages: C++
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved Chapter 12 Object-Oriented.
O BJECT O RIENTATION F UNDAMENTALS Prepared by: Gunjan Chhabra.
ProgrammingLanguages Programming Languages Computational Paradigms.
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.
Introduction CS 3358 Data Structures. What is Computer Science? Computer Science is the study of algorithms, including their  Formal and mathematical.
Programming Paradigms Procedural Functional Logic Object-Oriented.
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.
Chapter 8 High-Level Programming Languages. 8-2 Chapter Goals Describe the translation process and distinguish between assembly, compilation, interpretation,
Introduction CS 3358 Data Structures. What is Computer Science? Computer Science is the study of algorithms, including their  Formal and mathematical.
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.
CS 3050 Object-Oriented Analysis and Design. Objectives What is “Object-Oriented?” Object-Oriented Approach Vs. Structured Approach How Has the Object-Oriented.
OOP (Object Oriented Programming) Lecture 1. Why a new paradigm is needed? Complexity Five attributes of complex systems –Frequently, complexity takes.
The Beauty and Joy of Computing Lecture #5 Programming Paradigms invent.citris-uc.org
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.
Object Oriented Paradigm OOP’s. Problems with Structured Programming As programs grow ever larger and more complex, even the structured programming approach.
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.
Maitrayee Mukerji. INPUT MEMORY PROCESS OUTPUT DATA INFO.
1 Introduction to Engineering Spring 2007 Lecture 18: Digital Tools 2.
Object-oriented programming (OOP) is a programming paradigm using "objects" – data structures consisting of data fields and methods together with their.
1 Team Skill 3 Defining the System Part 1: Use Case Modeling Noureddine Abbadeni Al-Ain University of Science and Technology College of Engineering and.
Programming Paradigms, Software Architectural Patterns, and MVC CS 378 – Mobile Computing for iOS Dr. William C. Bulko.
Functional Programming
CS314 – Section 5 Recitation 9
Functional Programming
OOP - Object Oriented Programming
Algorithms and Problem Solving
Programming paradigms
Concepts of Object Oriented Programming
Basic 1960s It was designed to emphasize ease of use. Became widespread on microcomputers It is relatively simple. Will make it easier for people with.
The Beauty and Joy of Computing Lecture #4 Functions
An Introduction to Programming
Application Development Theory
Computer Programming.
Chap. 6 :: Control Flow Michael L. Scott.
Lesson 2 Programming constructs – Algorithms – Scratch – Variables Intro.
OOP vs Structured Programming
Java Programming Loops
Chap. 6 :: Control Flow Michael L. Scott.
Coding Concepts (Basics)
Algorithm and Ambiguity
High Level Programming Languages
Algorithms and Problem Solving
Introduction to Data Structure
Tonga Institute of Higher Education IT 141: Information Systems
Java Programming Loops
Basic OOP Concepts and Terms
Applying Use Cases (Chapters 25,26)
An Introduction to Programming
Tonga Institute of Higher Education IT 141: Information Systems
Software Development Techniques
Presentation transcript:

Mercer Institute for Personal Robots in Education (IPRE)‏ CSC 170 Computing: Science and Creativity

Mercer A programming paradigm is a fundamental style of computer programming, serving as a way of building the structure and elements of computer programs. A way to describe a style of programming The four primary paradigms Functional Imperative Object-Oriented Declarative PROGRAMMING PARADIGMS 2

Mercer 3

Computation is the evaluation of functions Plugging functions together Each has exactly 1 output (report) 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, Snap! FUNCTIONAL PROGRAMMING (REVIEW) en.wikipedia.org/wiki/Functional_programming f(x)=(x+3)* x + x 3 * x f x

Mercer 5

“Sequential” Programming Computation a series of steps Assignment allowed Setting variables Mutation allowed Changing variables Like following a recipe Procedure f(x) ans = x ans = ans ans = (x+3) * ans return ans Examples: Pascal, C, Java IMPERATIVE PROGRAMMING f(x)=(x+3)* x

Mercer Consider two styles for creating a list of the even integers in a list The imperative style is to loop through the elements of the input list and add the evens to a new list. What is the Output? 1 EXAMPLE USING 2 DIFFERENT STYLES

Mercer There are no assignments Uses reporter blocks to build up lists Report a new list that extends another list with a new item at the front without affecting the original list Report the value of the item at the specified place in the list Report all but the first item of the list Code Demo the same block in a functional style FUNCTIONAL STYLE

Mercer Instead of a loop, the block calls itself Each time, the list argument is a smaller list, until it’s empty Then the evens (item 1s) are reported to the block to build the new list THIS DOES THE SAME, IN A DIFFERENT STYLE

Mercer Started as an academic language cool, recursion, no loops, no assignment, difficult to learn Because there is no assignment, can run on different processors Allows programs to run on many processors Allows program to run on many computers Tell story of talking to Microsoft at my conference: Azure: 300 to 3,000 nodes, sequence and analyze genomes TV ad WHY FUNCTIONAL?

Mercer Common sense: sequence the things that need to be done Conveniently captures algorithmic patterns such sequence, selection, and repetition Easier to read and program More fun Can still encapsulate algorithms as a function (block) WHY IMPERATIVE?

Mercer Which of the following is true? a)Functional style code is actually imperative style code b)Imperative style code is actually functional style code c)Both a) and b) d)Neither a) or b) QUESTION

Mercer 13

Mercer OBJECT-ORIENTED PROGRAMMING (OOP) Objects put together data and functions that need that data Consider how we would model a sprite that can be animated and have different costumes Must ma intain attributes (data) about location, list of customs, size, transparency, direction … Has behaviors: Move from current location to another location Change size, transparency, direction, costume, … Say things Hide and show

Mercer 15 MESSAGES Objects exhibit many effects on each other These interactions are represented in software as “messages” Think of using a block

Mercer ENCAPSULATION Often need many of the same objects Numbers, Strings, PokerHands, Strategies, Employees … Need an efficient way to redefine the same thing many times and hide the details from other objects Each object (instance) has its own state — the set of values for that instance A block can define the behaviors and attributes

Mercer ONE TYPE CAN GENERATES MANY OBJECTS One class makes many instances (objects) Each object has its own values and identity

Mercer OOP IN SNAP Two instances of class counter Each object has its own values and identity

Mercer 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-imperative language PI OOP EXAMPLE: SKETCHPAD

Mercer Easier to model the real world and program What was 10,000 lines of code Became 1,000 functions with 10 lines of code Became 100 classes with 10 functions The little idea that became huge: Combine functions and the data they need to produce information into a structure WHY OO?

Mercer 21

Mercer A style of building the structure and elements of computer programs, that expresses the logic of a computation without describing its control flow Express what computation desired without specifying how it carries it out Often a series of queries Example: SQL, Prolog DECLARATIVE PROGRAMMING

Mercer Example: Return a list of books and the number of authors associated with each SELECT Book.title AS Title, COUNT(*) AS Authors FROM Book JOIN Book_author ON Book.isbn = Book_author.isbn GROUP BY Book.title; Example output might resemble the following: Title Authors Snap Examples and Guide 4 The Joy of Snap 1 An Introduction to Snap 2 Pitfalls of Snap 1 QUERY A DATA BASE WITH SQL

Mercer Many application involve lots of data, such things to buy on Ebay, Can generate information such as all vehicles for sale in the range of 8k to 10k in a 100 mile radius WHY DECLARATIVE?

Mercer 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!

Mercer 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

Mercer Each paradigm has its unique benefits I f 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

Mercer Dan Garcia Rick Mercer ATTRIBUTION