Finishing the Data Definition Recipe CS 5010 Program Design Paradigms “Bootcamp” Lesson 1.5 1 © Mitchell Wand, 2012-2014 This work is licensed under a.

Slides:



Advertisements
Similar presentations
Templates CS 5010 Program Design Paradigms “Bootcamp” Lesson
Advertisements

Two Draggable Cats CS 5010 Program Design Paradigms “Bootcamp” Lesson 3.4 TexPoint fonts used in EMF. Read the TexPoint manual before you delete this box.:
Reviewing your Program CS 5010 Program Design Paradigms “Bootcamp” Lesson 2.4 © Mitchell Wand, This work is licensed under a Creative Commons.
Lists vs. Structures CS 5010 Program Design Paradigms “Bootcamp” Lesson 6.1 © Mitchell Wand, This work is licensed under a Creative Commons Attribution-NonCommercial.
The Different Kinds of Data CS 5010 Program Design Paradigms “Bootcamp” Lesson
The Function Design Recipe CS 5010 Program Design Paradigms “Bootcamp” Lesson 1.1 TexPoint fonts used in EMF. Read the TexPoint manual before you delete.
Midterm Review CS 5010 Program Design Paradigms “Bootcamp” Lesson 9.4 TexPoint fonts used in EMF. Read the TexPoint manual before you delete this box.:
The Data Design Recipe CS 5010 Program Design Paradigms “Bootcamp” Lesson © Mitchell Wand, This work is licensed under a Creative Commons.
Classes, Objects, and Methods CS 5010 Program Design Paradigms "Bootcamp" Lesson 10.1 © Mitchell Wand, This work is licensed under a Creative.
Lists CS 5010 Program Design Paradigms “Bootcamp” Lesson 4.1 TexPoint fonts used in EMF. Read the TexPoint manual before you delete this box.: AAA 1 ©
Case Study: Free Variables CS 5010 Program Design Paradigms “Bootcamp” Lesson 7.3 TexPoint fonts used in EMF. Read the TexPoint manual before you delete.
Ormap, andmap, and filter CS 5010 Program Design Paradigms “Bootcamp” Lesson 5.3 TexPoint fonts used in EMF. Read the TexPoint manual before you delete.
Structural Decomposition CS 5010 Program Design Paradigms “Bootcamp” Lesson 2.1 © Mitchell Wand, This work is licensed under a Creative Commons.
Introducing General Recursion CS 5010 Program Design Paradigms “Bootcamp” Lesson 8.2 TexPoint fonts used in EMF. Read the TexPoint manual before you delete.
Trees CS 5010 Program Design Paradigms “Bootcamp” Lesson 6.2 © Mitchell Wand, This work is licensed under a Creative Commons Attribution-NonCommercial.
Mutually-Recursive Data Definitions CS 5010 Program Design Paradigms “Bootcamp” Lesson 6.4 © Mitchell Wand, This work is licensed under a Creative.
Lists of Lists CS 5010 Program Design Paradigms “Bootcamp” Lesson © Mitchell Wand, This work is licensed under a Creative Commons Attribution-NonCommercial.
Patterns of Communication Between Objects CS 5010 Program Design Paradigms "Bootcamp" Lesson 11.1 © Mitchell Wand, This work is licensed under.
Solving Your Problem by Generalization CS 5010 Program Design Paradigms “Bootcamp” Lesson 7.1 © Mitchell Wand, This work is licensed under a.
The Last Lecture CS 5010 Program Design Paradigms "Bootcamp" Lesson 12.4 © Mitchell Wand, This work is licensed under a Creative Commons Attribution-NonCommercial.
How to Learn in This Course CS 5010 Program Design Paradigms “Bootcamp” Lesson 0.1 © Mitchell Wand, This work is licensed under a Creative Commons.
The Data Design Recipe CS 5010 Program Design Paradigms “Bootcamp” Lesson © Mitchell Wand, This work is licensed under a Creative Commons.
The Function Design Recipe CS 5010 Program Design Paradigms “Bootcamp” Lesson 1.1 TexPoint fonts used in EMF. Read the TexPoint manual before you delete.
Examining Two Pieces of Data CS 5010 Program Design Paradigms “Bootcamp” Lesson © Mitchell Wand, This work is licensed under a Creative.
The Design Recipe using Classes CS 5010 Program Design Paradigms "Bootcamp" Lesson 10.5 © Mitchell Wand, This work is licensed under a Creative.
Design Strategies 1: Combine Simpler Functions CS 5010 Program Design Paradigms “Bootcamp” Lesson © Mitchell Wand, This work is licensed.
Design Strategies 3: Divide into cases CS 5010 Program Design Paradigms “Bootcamp” Lesson © Mitchell Wand, This work is licensed under.
The Point of This Course CS 5010 Program Design Paradigms “Bootcamp” Lesson 0.1 © Mitchell Wand, This work is licensed under a Creative Commons.
Generalizing Similar Functions CS 5010 Program Design Paradigms “Bootcamp” Lesson 5.1 TexPoint fonts used in EMF. Read the TexPoint manual before you delete.
Design Strategies 2: Using a template CS 5010 Program Design Paradigms “Bootcamp” Lesson 2.1 © Mitchell Wand, This work is licensed under a Creative.
Case Study: Free Variables CS 5010 Program Design Paradigms “Bootcamp” Lesson TexPoint fonts used in EMF. Read the TexPoint manual before you delete.
Two Draggable Cats CS 5010 Program Design Paradigms “Bootcamp” Lesson TexPoint fonts used in EMF. Read the TexPoint manual before you delete this.
More examples of invariants CS 5010 Program Design Paradigms “Bootcamp” Lesson © Mitchell Wand, This work is licensed under a Creative.
Lists of Structures CS 5010 Program Design Paradigms “Bootcamp” Lesson TexPoint fonts used in EMF. Read the TexPoint manual before you delete this.
Destructor Templates CS 5010 Program Design Paradigms “Bootcamp” Lesson
Testing Objects CS 5010 Program Design Paradigms "Bootcamp" Lesson © Mitchell Wand, This work is licensed under a Creative Commons Attribution-NonCommercial.
Solving Your Problem by Generalization CS 5010 Program Design Paradigms “Bootcamp” Lesson 7.1 © Mitchell Wand, This work is licensed under a.
Lists vs. Structures CS 5010 Program Design Paradigms “Bootcamp” Lesson © Mitchell Wand, This work is licensed under a Creative Commons.
The DD  OO Recipe CS 5010 Program Design Paradigms "Bootcamp" Lesson 10.4 © Mitchell Wand, This work is licensed under a Creative Commons Attribution-NonCommercial.
Organization of This Course CS 5010 Program Design Paradigms “Bootcamp” Lesson 0.2 © Mitchell Wand, This work is licensed under a Creative Commons.
Halting Measures and Termination Arguments CS 5010 Program Design Paradigms “Bootcamp” Lesson TexPoint fonts used in EMF. Read the TexPoint manual.
Non-Empty Lists CS 5010 Program Design Paradigms “Bootcamp” Lesson TexPoint fonts used in EMF. Read the TexPoint manual before you delete this box.:
The Last Lecture CS 5010 Program Design Paradigms "Bootcamp" Lesson © Mitchell Wand, This work is licensed under a Creative Commons Attribution-NonCommercial.
Using the List Template CS 5010 Program Design Paradigms “Bootcamp” Lesson TexPoint fonts used in EMF. Read the TexPoint manual before you delete.
Using the List Template CS 5010 Program Design Paradigms “Bootcamp” Lesson 4.2 TexPoint fonts used in EMF. Read the TexPoint manual before you delete this.
Midterm Review CS 5010 Program Design Paradigms “Bootcamp” Lesson TexPoint fonts used in EMF. Read the TexPoint manual before you delete this box.:
Solving Your Problem by Generalization CS 5010 Program Design Paradigms “Bootcamp” Lesson © Mitchell Wand, This work is licensed under.
Classes, Objects, and Interfaces CS 5010 Program Design Paradigms "Bootcamp" Lesson © Mitchell Wand, This work is licensed under a Creative.
How to use an Observer Template
Generalizing Similar Functions
CS 5010 Program Design Paradigms "Bootcamp" Lesson 9.4
CS 5010 Program Design Paradigms “Bootcamp” Lesson 1.3
Introduction to Invariants
Reviewing your Program
More Recursive Data Types
CS 5010 Program Design Paradigms “Bootcamp” Lesson 6.2
CS 5010 Program Design Paradigms “Bootcamp” Lesson 4.1
CS 5010 Program Design Paradigms "Bootcamp" Lesson 12.1
CS 5010 Program Design Paradigms “Bootcamp” Lesson 1.3
CS 5010 Program Design Paradigms “Bootcamp” Lesson 5.1
The Different Kinds of Data
Solving Your Problem by Generalization
More examples of invariants
ormap, andmap, and filter
Generalizing Similar Functions
The Iterative Design Recipe
CS 5010 Program Design Paradigms "Bootcamp" Lesson 12.1
CS 5010 Program Design Paradigms “Bootcamp” Lesson 4.1
When do I need an invariant?
Presentation transcript:

Finishing the Data Definition Recipe CS 5010 Program Design Paradigms “Bootcamp” Lesson © Mitchell Wand, This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License. Creative Commons Attribution-NonCommercial 4.0 International License

Learning Objectives for This Lesson By the time you finish this lesson, you should be able to: – explain why it is so important to get the template correct – write a complete data definition, including template and examples – list the 4 questions you should ask yourself when reviewing a data definition 2

There is only one correct template Going from the data definition to the template is completely mechanical For every data definition there is one and only one correct template 3

Get the template right! Getting templates right is important: – the template tells you exactly how to go about writing a function for manipulating the values from the data definition – a large portion of student errors come from getting the template wrong, or from not following the template exactly. 4

DDR Step 6: Examples Our coding standard: examples are required only for mixed data Provide one example for each alternative. Provide each example as a constant Usually you will need these for testing 5

Examples for Bar Order ;; A BarOrder is one of ;; -- (make-coffee Size CoffeeType Boolean) ;; -- (make-wine Vineyard Year) ;; -- (make-tea Size TeaType) ;; INTERP:.... (define coffee-order1 (make-coffee 12 "kona" true)) (define coffee-order2 (make-coffee 16 "decaf" false)) (define wine-order1 (make-wine "Chateau St. Jean" 2005)) (define tea-order1 (make-tea 12 "Oolong")) 6

DDR Step 7: Review Nothing is done until you review it! Before you move on, look at your data definition and ask the following questions 7

Reviewing a Data Design 1. Is the interpretation clear and unambiguous? 2. Can you represent all the information you need for your program? 3. Do you need all of the data in your representation? 4. Does every combination of values make sense? If not, document the meaningful combinations with a WHERE clause. 8