Abstraction IS 101Y/CMSC 101 Computational Thinking and Design Tuesday, September 17, 2013 Marie desJardins University of Maryland, Baltimore County.

Slides:



Advertisements
Similar presentations
compilers and interpreters
Advertisements

Lecture 1: Overview of Computers & Programming
Problem Solving and Algorithm Design
Chapter 6 Problem Solving and Algorithm Design. 6-2 Chapter Goals Determine whether a problem is suitable for a computer solution Describe the computer.
Introduction to Analysis of Algorithms
Chapter 2: Algorithm Discovery and Design
B-1 Lecture 2: Problems, Algorithms, and Programs © 2000 UW CSE University of Washington Computer Programming I.
Chapter 2 The Algorithmic Foundations of Computer Science
Algorithm Design CS105. Problem Solving Algorithm: set of unambiguous instructions to solve a problem – Breaking down a problem into a set of sub- problems.
Chapter 6 Problem Solving and Algorithm Design Nell Dale John Lewis.
CS 201 Functions Debzani Deb.
An Introduction to Programming with C++ Fifth Edition Chapter 1 An Introduction to Programming.
Programming Logic and Design, Introductory, Fourth Edition1 Understanding Computer Components and Operations (continued) A program must be free of syntax.
Chapter 1 Program Design
Chapter 2: Algorithm Discovery and Design
Chapter 2: Algorithm Discovery and Design
Chapter 3 Planning Your Solution
Adapted from slides by Marie desJardins
DCT 1123 PROBLEM SOLVING & ALGORITHMS INTRODUCTION TO PROGRAMMING.
Introducing Java.
Sw development1 Software Development 1.Define the problem (Analysis) 2.Plan the solution 3.Code 4.Test and debug 5.Maintain and Document.
Abstraction IS 101Y/CMSC 101 Computational Thinking and Design Tuesday, September 17, 2013 Carolyn Seaman University of Maryland, Baltimore County.
Introduction to Computational Thinking Vicky Chen.
GENERAL CONCEPTS OF OOPS INTRODUCTION With rapidly changing world and highly competitive and versatile nature of industry, the operations are becoming.
O BJECT O RIENTATION F UNDAMENTALS Prepared by: Gunjan Chhabra.
Simple Program Design Third Edition A Step-by-Step Approach
สาขาวิชาเทคโนโลยี สารสนเทศ คณะเทคโนโลยีสารสนเทศ และการสื่อสาร.
Design IS 101Y/CMSC 101 Computational Thinking and Design Tuesday, October 15, 2013 Carolyn Seaman University of Maryland, Baltimore County.
Algorithmic Problem Solving CMSC 201 Adapted from slides by Marie desJardins (Spring 2015 Prof Chang version)
Chapter 2: Algorithm Discovery and Design Invitation to Computer Science, C++ Version, Third Edition.
Invitation to Computer Science, Java Version, Second Edition.
Goals of Course Introduction to the programming language C Learn how to program Learn ‘good’ programming practices.
Problem Solving and Algorithm Design. 2 Problem Solving Problem solving The act of finding a solution to a perplexing, distressing, vexing, or unsettled.
An Introduction to Programming with C++ Sixth Edition
The Beauty and Joy of Computing Lecture #3 : Creativity & Abstraction UC Berkeley EECS Lecturer Gerald Friedland.
By the end of this session you should be able to...
Abstraction IS 101Y/CMSC 101 Computational Thinking and Design Tuesday, September 9, 2014 Carolyn Seaman Susan Martin University of Maryland, Baltimore.
Programming for Beginners Martin Nelson Elizabeth FitzGerald Lecture 5: Software Design & Testing; Revision Session.
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.
IXA 1234 : C++ PROGRAMMING CHAPTER 1. PROGRAMMING LANGUAGE Programming language is a computer program that can solve certain problem / task Keyword: Computer.
CPSC 121: Models of Computation Unit 0 Introduction George Tsiknis Based on slides by Patrice Belleville and Steve Wolfman.
How to Read Code Benfeard Williams 6/11/2015 Susie’s lecture notes are in the presenter’s notes, below the slides Disclaimer: Susie may have made errors.
The Programming Process Define the problem* Make or buy software? Design the program * Code (write) the program Test (debug) the program Document the.
The Software Development Process
1 CSCD 326 Data Structures I Software Design. 2 The Software Life Cycle 1. Specification 2. Design 3. Risk Analysis 4. Verification 5. Coding 6. Testing.
CSCI 1100/1202 April 1-3, Program Development The creation of software involves four basic activities: –establishing the requirements –creating.
1 Program Development  The creation of software involves four basic activities: establishing the requirements creating a design implementing the code.
8.1 8 Algorithms Foundations of Computer Science  Cengage Learning.
1 The Software Development Process ► Systems analysis ► Systems design ► Implementation ► Testing ► Documentation ► Evaluation ► Maintenance.
INVITATION TO Computer Science 1 11 Chapter 2 The Algorithmic Foundations of Computer Science.
Algorithms and Pseudocode
Chapter 1 The Phases of Software Development. Software Development Phases ● Specification of the task ● Design of a solution ● Implementation of solution.
Chapter 2: Algorithm Discovery and Design Invitation to Computer Science.
CSC 212 – Data Structures Lecture 15: Big-Oh Notation.
PROGRAMMING FUNDAMENTALS INTRODUCTION TO PROGRAMMING. Computer Programming Concepts. Flowchart. Structured Programming Design. Implementation Documentation.
INTRODUCTION TO COMPUTER PROGRAMMING(IT-303) Basics.
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.
LECTURE 22: BIG-OH COMPLEXITY CSC 212 – Data Structures.
Introduction to Computer Programming Concepts M. Uyguroğlu R. Uyguroğlu.
CMPSC 16 Problem Solving with Computers I Spring 2014 Instructor: Tevfik Bultan Lecture 6: Stepwise refinement revisited, Midterm review.
ICS 3UI - Introduction to Computer Science
Lecture 2 Introduction to Programming
Problem Solving and Algorithm Design
Algorithm Discovery and Design
The Programming Process
Algorithm and Ambiguity
An Introduction to Programming with C++ Fifth Edition
Vocabulary Algorithm - A precise sequence of instructions for processes that can be executed by a computer Low level programming language: A programming.
WRITING AN ALGORITHM, PSEUDOCODE, AND FLOWCHART LESSON 2.
Presentation transcript:

Abstraction IS 101Y/CMSC 101 Computational Thinking and Design Tuesday, September 17, 2013 Marie desJardins University of Maryland, Baltimore County

Getting Help CSEE Help Center ITE 201E – hours TBA but usually M-F 10-5, plus evening hours on some days help-center/ Tutors may not know Processing, but all know Java (which is similar) and are very helpful! IS Java Lab (?)

Abstraction Abstraction is the process of generalizing away from the details of a problem to simplify and focus on its key aspects We use abstraction for problem solving, design, organization, and simplification Examples from everyday life: Smart thermostats Steering wheels folders and labels Schedules and calendars Language!!

Abstraction in Computing Abstraction is ubiquitous in all computing disciplines “It’s All Just Bits” The interpretation (meaning) of data depends on how it is used The same bit sequence can represent an integer, a decimal number, a sequence of characters, or anything else you might decide it means Layers of computing hardware, including gates, chips, and components Programming languages are abstractions of machine language Functional decomposition == layers of abstraction Models and simulations: abstractions of real-world phenomena We can study, analyze, and experiment with models more easily than experimenting on the real world

Programming Enables Problem Solving, Expression, and Knowledge Creation Programs are written to execute algorithms Requires an understanding of how instructions are processed Programs are executed to automate processes A single program can be run multiple times, on many machines Executable programs increase the scale of solvable problems Programming is facilitated by appropriate abstractions Functions are re-usable programming abstractions Parameterization can be used to generalize a specific solution Data abstraction can separate behavior from implementation APIs and libraries simplify complex programming tasks Programs are developed and used by people Developing programs is an iterative process Finding and eliminating errors is part of the process Documentation is needed for maintainable programs

Big Idea: Design Problem solving often produces multiple possible solutions Or multiple ways to implement the solution Design is the process of making those decisions and choices Design at a high level Is it cost-effective to automate kidney exchange? Should we use a relational or object-oriented database? Design at a low level How do I structure this function? What do I call this variable?

Design Process for Programs First, understand the problem clearly Second, write the solution in English Test its correctness by manually applying it to some simple – and then more complex -- examples Optionally, “translate” the solution into pseudocode Advanced programmers will use this step as an abstraction to avoid the syntactic details of a particular programming language Next, translate the solution into a programming language Finally, implement (type) and test (carefully!) your solution

Example: Counting Print the numbers from one to N N is a variable that can change each time the program is called [an abstraction!!] For example, “printNumbers (7)” should print:

Counting in English: Attempt #1 First attempt at English: Count from one to N Print out each number Not really an algorithm – just a restatement (what is the primitive action “count”??)

Counting in English: Attempt #2 Next attempt: Set the variable “current” to 1 Print the value of “current” Add one to “current” If “current” is greater than N, stop Otherwise, go back to “print” step Turns out that “go to” statements are bad design (for reasons we’ll talk about later) Let’s try it again, using something that looks more like a loop with a condition

Counting in English: Attempt #3 (almost right!) Set the variable “current” to 1 While “current” is less than N: Print the value of “current” Add one to “current” Test by hand: what if N = 3? Boundary cases: what if N = 0? N = -4? Possible error cases: what if N = 8.73? what if N = “this isn’t a number”?

Counting in English: Processing Version void printNumber (int N) { int current = 1; while (current <= N) { println (current); current = current + 1; }

Exercise #1: Multiplication Work in your team – OK to split into smaller groups of 2 or 3 when you’re at the implementation step How would you multiply two numbers, using only the addition operator? Understand the problem – state some examples Write the solution in English Test the English solution! Write the solution in Processing Test the program! Concepts: iterations, efficiency

Exercise #2: Guessing With your team, write Processing code to guess a number between 1 and 100 Remember the algorithmic design process: Understand the problem – work through some examples by hand! Write a solution in English and test it – then get a TF or instructor to OK your solution before moving on! Translate your solution into Processing Implement, test, and show a TF or instructor! Be prepared to explain why your approach is a good way to solve the problem