6 Dec 2001Kestrel1 Teaching with Patterns Matthias Felleisen Daniel Jackson.

Slides:



Advertisements
Similar presentations
Higher-Order Functions and Loops c. Kathi Fisler,
Advertisements

If you view this talk in PowerPoint, turn on comments (View | Comments in PowerPoint) to read remarks made during the talk but not included on the slide.
5 October 2001IFIP WG 2.31 preparation start drscheme set language level to Beginner open in Presentations –length1.ss –planets0.ss –lambda.ss –convert.ss.
Welcome to. Who am I? A better way to code Design Patterns ???  What are design patterns?  How many are there?  How do I use them?  When do I use.
1 Programming Languages (CS 550) Mini Language Interpreter Jeremy R. Johnson.
Lab1 Lab 1: CSG 711: Programming to Structure Karl Lieberherr.
1 Programming Languages (CS 550) Lecture Summary Functional Programming and Operational Semantics for Scheme Jeremy R. Johnson.
CSE341: Programming Languages Lecture 16 Datatype-Style Programming With Lists or Structs Dan Grossman Winter 2013.
Background information Formal verification methods based on theorem proving techniques and model­checking –to prove the absence of errors (in the formal.
Multi-way Trees CS 5010 Program Design Paradigms “Bootcamp” Lesson 6.6 © Mitchell Wand, This work is licensed under a Creative Commons Attribution-NonCommercial.
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 ©
preparation start drscheme set language level to Beginner open in Presentations –length1.ss –length2.ss –icons.ss –planets0.ss –convert.ss add teachpack.
Structural Decomposition CS 5010 Program Design Paradigms “Bootcamp” Lesson 2.1 © Mitchell Wand, This work is licensed under a Creative Commons.
1 An introduction to design patterns Based on material produced by John Vlissides and Douglas C. Schmidt.
Mutually-Recursive Data Definitions CS 5010 Program Design Paradigms “Bootcamp” Lesson 6.4 © Mitchell Wand, This work is licensed under a Creative.
Foldr CS 5010 Program Design Paradigms “Bootcamp” Lesson 5.4 TexPoint fonts used in EMF. Read the TexPoint manual before you delete this box.: AAA © Mitchell.
Solving Your Problem by Generalization CS 5010 Program Design Paradigms “Bootcamp” Lesson 7.1 © Mitchell Wand, This work is licensed under a.
Useful Techniques in Teaching Reading
High level & Low level language High level programming languages are more structured, are closer to spoken language and are more intuitive than low level.
Arbitrarily Long Data Structures: Lists and Recursion CMSC Introduction to Computer Programming October 4, 2002.
CS CS1321: Introduction to Programming Georgia Institute of Technology College of Computing Lecture 11 Sept 27th, 2001 Fall Semester.
Recap (önemli noktaları yinelemek) from last week Paradigm Kay’s Description Intro to Objects Messages / Interconnections Information Hiding Classes Inheritance.
Polymorphism, Inheritance Pt. 1 COMP 401, Fall 2014 Lecture 7 9/9/2014.
4 Dec 2001Kestrel1 From Patterns to Programming Languages Matthias Felleisen Northeastern University.
Recursion: Linear and Tree Recursive Processes and Iteration CMSC Introduction to Computer Programming October 7, 2002.
Object-Oriented Software Development F Software Development Process F Analyze Relationships Among Objects F Class Development F Class Design Guidelines.
The Point of This Course CS 5010 Program Design Paradigms “Bootcamp” Lesson 0.1 © Mitchell Wand, This work is licensed under a Creative Commons.
Chapter 16 Applying UML and Patterns Craig Larman
CS 603: Programming Language Organization Lecture 7 Spring 2003 Department of Computer Science University of Alabama Joel Jones.
Telecooperation/RBG Technische Universität Darmstadt Copyrighted material; for TUD student use only Introduction to Computer Science I Topic 8: Accumulating.
Chapter 6 Introduction to Defining Classes. Objectives: Design and implement a simple class from user requirements. Organize a program in terms of a view.
CS CS1321: Introduction to Programming Georgia Institute of Technology College of Computing Lecture 10 Sept 25th, 2001 Fall Semester.
More examples of invariants CS 5010 Program Design Paradigms “Bootcamp” Lesson © Mitchell Wand, This work is licensed under a Creative.
Behavioral Patterns CSE301 University of Sunderland Harry R Erwin, PhD.
Solving Your Problem by Generalization CS 5010 Program Design Paradigms “Bootcamp” Lesson 7.1 © Mitchell Wand, This work is licensed under a.
Patterns in cs education Matthias Felleisen & Daniel Jackson NDIST · December 5, 2001.
GoodOO Programming Practice in Java © Allan C. Milne v
Lists vs. Structures CS 5010 Program Design Paradigms “Bootcamp” Lesson © Mitchell Wand, This work is licensed under a Creative Commons.
Cs1321 December 6, 2001 Review. What is computer science? What's an algorithm? Processes and programs Overview of some programming language concepts Functional.
Formal Verification. Background Information Formal verification methods based on theorem proving techniques and model­checking –To prove the absence of.
The Last Lecture CS 5010 Program Design Paradigms "Bootcamp" Lesson © Mitchell Wand, This work is licensed under a Creative Commons Attribution-NonCommercial.
Lab 11 Lab 1: CSG 711: Programming to Structure Karl Lieberherr.
1 Programming Languages (CS 550) Lecture 2 Summary Mini Language Interpreter Jeremy R. Johnson.
CS CS1321: Introduction to Programming Georgia Institute of Technology College of Computing Lecture 13 October 4, 2001 Fall Semester.
Overview of Creational Patterns ©SoftMoore ConsultingSlide 1.
Comp 311 Principles of Programming Languages Lecture 2 Syntax Corky Cartwright August 26, 2009.
Identifying Mathematical Knowledge for Teaching at the Secondary Level (6-12) from the Perspective of Practice Joint NSF-CLT Conference on Curriculum,
COMP 412, FALL Type Systems C OMP 412 Rice University Houston, Texas Fall 2000 Copyright 2000, Robert Cartwright, all rights reserved. Students.
Teaching Compiler Design
CS 5010 Program Design Paradigms “Bootcamp” Lesson 5.2
6.001 SICP Compilation Context: special purpose vs. universal machines
September 4, 1997 Programming Languages (CS 550) Lecture 6 Summary Operational Semantics of Scheme using Substitution Jeremy R. Johnson TexPoint fonts.
CS 5010 Program Design Paradigms "Bootcamp" Lesson 12.1
CSE341: Programming Languages Lecture 16 Datatype-Style Programming With Lists or Structs Dan Grossman Spring 2013.
Survey of Knowledge Base Content
Case Study: Undefined Variables
CSE341: Programming Languages Lecture 16 Datatype-Style Programming With Lists or Structs Dan Grossman Spring 2017.
Mini Language Interpreter Programming Languages (CS 550)
Logical architecture refinement
The Metacircular Evaluator
The Structure and Interpretation of the Computer Science Curriculum
Solving Your Problem by Generalization
Design Patterns for Recursive Descent Parsing
Lecture 12: Message passing The Environment Model
CS 5010 Program Design Paradigms “Bootcamp” Lesson 6.5
Let's Play "What's the Question"
CSE341: Programming Languages Lecture 16 Datatype-Style Programming With Lists or Structs Dan Grossman Spring 2016.
6.001 SICP Interpretation Parts of an interpreter
More examples of invariants
CSE341: Programming Languages Lecture 16 Datatype-Style Programming With Lists or Structs Dan Grossman Spring 2019.
Presentation transcript:

6 Dec 2001Kestrel1 Teaching with Patterns Matthias Felleisen Daniel Jackson

6 Dec 2001Kestrel2 Patterns in the Classroom: The Rice Experience Matthias Felleisen Northeastern University

6 Dec 2001Kestrel3 Patterns in Courses graduate Course (fall 94/spring 95) junior-level PL course junior-level PD/FM course second-semester course

6 Dec 2001Kestrel4 Patterns in Courses graduate Course (94) junior-level PL course junior-level PD/FM course second-semester course

6 Dec 2001Kestrel5 Rice’s Introductory Year Comp 210: Design Recipes (HtDP)HtDP –majors and non-majors –assumes no background –uses Scheme and some Java Comp 212: Design Patterns (GoF) –majors mostly (plus some C++ non-majors) –assumes 210-like background –uses some Scheme and Java

6 Dec 2001Kestrel6 Design Recipes & Some Context From Recipes to Patterns Pattern Coverage Some Exepriences

6 Dec 2001Kestrel7 210: Design Recipes & Context

6 Dec 2001Kestrel8 Design Recipes to be designed inout How do we wire the “program” to the rest of the world?

6 Dec 2001Kestrel9 Design Recipes radical model-view separation design “internals” of programs use “internal” data, not “external” information teacher provides view

6 Dec 2001Kestrel10 Design Recipes understand classes of data –representation of (external) information as data in your favorite language understand “program” as function –that is triggered by events –that consumes/produces data most important: connect class definition and function definition

6 Dec 2001Kestrel11 The Basic Design Recipe data analysis and class definition contract, purpose statement, header in-out (effect) examples function template function definition testing, test suite development

6 Dec 2001Kestrel12 From Class Definitions to Function Templates the structure of class definitions the structure of function templates

6 Dec 2001Kestrel13 Design Recipes: Class Definitions use rigorous language, not formalism naïve set theory –basic sets: numbers, chars, booleans –intervals –(labeled) products, that is, structures –(tagged) unions –self-references –mutual references –vectors (natural numbers)

6 Dec 2001Kestrel14 Design Recipes: Class Definitions (2) (define-struct spider (name size legs)) A spider is a structure: (make-spider symbol number number)

6 Dec 2001Kestrel15 Design Recipes: Class Definitions (3) A zoo animal is either a spider an elephant a giraffe a mouse … Each of these classes of animals has its own definition

6 Dec 2001Kestrel16 Design Recipes: Class Definitions (4) A list of zoo animals is either empty (cons animal a-list-of-zoo-animals) Let’s make examples: empty (by definition) (cons (make-spider ‘Asterix 1 6) empty) (cons (make-spider ‘Obelix 99 6) (cons … …))

6 Dec 2001Kestrel17 Design Recipes: Class Definitions (5) (define-struct child (name father mother)) A family tree is either ‘unknown (make-child symbol a-family-tree a-family-tree-2) Many, if not most, interesting class definitions are self-referential.

6 Dec 2001Kestrel18 Design Recipes: Function Templates (Structure) a function template reflects the structure of the class definitions this match helps –designers guide the process –readers comprehend –teachers diagnose weaknesses –modifiers/maintainers analyze or change

6 Dec 2001Kestrel19 Design Recipes: Templates (2) is it a basic class? is it a union? is it a structure? is it self-referential? “domain knowledge” case analysis extract field values annotate for recursion

6 Dec 2001Kestrel20 Design Recipes: Templates (3) A list of zoo animals is either empty (cons animal a-list-of-zoo-animals) ;; fun-for-zoo : list-of-zoo-animals -> ??? (define (fun-for-zoo a-loZA) … ) is it a union?

6 Dec 2001Kestrel21 Design Recipes: Templates (4) A list of zoo animals is either empty (cons animal a-list-of-zoo-animals) ;; fun-for-zoo : list-of-zoo-animals -> ??? (define (fun-for-zoo a-loZA) (cond [ > > ] [ > > ])) what are the sub-classes

6 Dec 2001Kestrel22 Design Recipes: Templates (5) A list of zoo animals is either empty (cons animal a-list-of-zoo-animals) ;; fun-for-zoo : list-of-zoo-animals -> ??? (define (fun-for-zoo a-loZA) (cond [ (empty? a-loZA) > ] [ (cons? a-loZA) > ])) are any of the potential inputs structures?

6 Dec 2001Kestrel23 Design Recipes: Templates (6) A list of zoo animals is either empty (cons animal a-list-of-zoo-animals) ;; fun-for-zoo : list-of-zoo-animals -> ??? (define (fun-for-zoo a-loZA) (cond [ (empty? a-loZA) … ] [ (cons? a-loZA) … (first a-loZA) … … (rest a-loZA) … ])) is the class definition self-referential?

6 Dec 2001Kestrel24 Design Recipes: Templates (7) A list of zoo animals is either empty (cons animal a-list-of-zoo-animals) ;; fun-for-zoo : list-of-zoo-animals -> ??? (define (fun-for-zoo a-loZA) (cond [ (empty? a-loZA) … ] [ (cons? a-loZA) … (first a-loZA) … … (rest a-loZA) … ]))

6 Dec 2001Kestrel25 Design Recipes: Defining Functions templates remind beginners of all the information that is available –which cases –which field values, argument values –which natural recursions are computed the goal of function definitions is –to compute with the available values –to combine the computed effects

6 Dec 2001Kestrel26 Design Recipes: Overview basic data, intervals of numbers structures unions self-reference in class description mutual references generative recursion special attributes: –accumulators –effects abstraction of designs

6 Dec 2001Kestrel27 Design Recipes: Conclusion get students used to discipline from DAY ONE use scripted question-and-answer game until they realize they can do it on their own

6 Dec 2001Kestrel28 212: From Recipes to Patterns

6 Dec 2001Kestrel29 Design Patterns introduce Java use design recipes to organize classes and methods explain code as instances of design patterns

6 Dec 2001Kestrel30 Scheme to Java: Class Hierarchy A list of zoo animals is either empty (cons animal a-list-of-zoo-animals) List of zoo animals EmptyCons: animal list of zoo animals

6 Dec 2001Kestrel31 Scheme to Java: Code Allocation ;; fun-for-zoo : list-of-zoo-animals -> ??? (define (fun-for-zoo a-loZA) (cond [ (empty? a-loZA) … ] [ (cons? a-loZA) … (first a-loZA) … … (rest a-loZA) … ])) List of zoo animals Empty: … Cons: animal list of zoo animals

6 Dec 2001Kestrel32 Scheme to Java: Code Allocation ;; fun-for-zoo : list-of-zoo-animals -> ??? (define (fun-for-zoo a-loZA) (cond [ (empty? a-loZA) … ] [ (cons? a-loZA) … (first a-loZA) … … (rest a-loZA) … ])) List of zoo animals Empty: … Cons: animal list of zoo animals Interpreter Pattern (Composite)

6 Dec 2001Kestrel33 Which Patterns Interpreter Composite Template and Hook Command Factory Abstract Factory (Virtual Constructor) State (and a few more on occasion)

6 Dec 2001Kestrel34 How about MVC? 210 –DrScheme implements MVC in REPL –TeachPacks implements GUI MVC 212 –DrJava implements MVC –we implement MVC for students 312 – Students implement MVC directly

6 Dec 2001Kestrel35 312: Designing, and Reasoning about, Sw reasonably large programs, present and discuss programs in class maintain your own code over the course of a month or two switch code, modify code of others

6 Dec 2001Kestrel36 312: Design, and Reason about, Sw the aha course students understand why and when patterns matter the reward for going thru 212, 212

6 Dec 2001Kestrel37 Programs have a place in the curriculum it is not in the first year (except for coding in this style).