13
Design Patterns in Education Josh Steele Matt Aguirre April 8, 2002

Design Patterns in Education Josh Steele Matt Aguirre April 8, 2002

Embed Size (px)

Citation preview

Page 1: Design Patterns in Education Josh Steele Matt Aguirre April 8, 2002

Design Patterns in Education

Josh Steele

Matt Aguirre

April 8, 2002

Page 2: Design Patterns in Education Josh Steele Matt Aguirre April 8, 2002

Outline

Josh What is a Design Pattern?

Difficulty in teaching DPs Timing your introduction

Elementary Design Patterns

Matt Brute Force Patterns (think GoF) Pedagogical Design Patterns

Class Discussion

Page 3: Design Patterns in Education Josh Steele Matt Aguirre April 8, 2002

What is a Design Pattern?

Originally envisioned at the 1987 OOPSLA conference (at least in a SW context)

“Organizational concepts for designing quality object oriented software” [Gelfand] Concise, correct, reusable

“Embodiment of a template for the solution to a recurring problem” [Shaffer]

“Descriptions of communicating objects and classes that are customized to solve a general design problem in a particular context” [GoF]

Page 4: Design Patterns in Education Josh Steele Matt Aguirre April 8, 2002

In Layman’s Terms

Design Patterns are:Tools to help teach OOP and OODConcepts to help improve quality of OOPUsed to promote reuseHelp problem solving ability (“have I seen that

problem before?”)Tools to help communicate ideasOther definitions?

Page 5: Design Patterns in Education Josh Steele Matt Aguirre April 8, 2002

Why are they difficult to teach?

Shift in paradigm from Procedural to OOP Often a major hurdle for most students OOP hard enough to comprehend, DPs at the same

time even worse

OO background needed to fully appreciate their use Data Structures class may not be enough experience

Level of granularity to present is open question

Page 6: Design Patterns in Education Josh Steele Matt Aguirre April 8, 2002

Where to Start?

Data Structures Class Pros: Start of OO Education, can start DP exposure early Cons: Programming experience limited, GoF too complex Common text: DS Book with Decorators, Singletons, etc

CS 6704 Pros: Much OO experience under belt, many DPs seen (maybe not

realized though) Cons: No formal DP education yet – teaching old dog new tricks (or the

formality of those tricks) difficult; only graduate exposure! Common text: GoF

Middle of the Road 3000 level? 4000 level? Is there a good class at this level to introduce Design Patterns?

Page 7: Design Patterns in Education Josh Steele Matt Aguirre April 8, 2002

Elementary Design Patterns

Intended for novices Simpler standard Design Patterns Begin DP education early by (what else?)

focusing on good design More effective teaching (from the level the

students are at) and learning (efficiency when solving recurring problems)

Page 8: Design Patterns in Education Josh Steele Matt Aguirre April 8, 2002

How to use Elementary Patterns

Not as an exam questionMinimizes the impact!

As Tools to read, write and organize code Vocabulary between students Benchmark for code quality

Page 9: Design Patterns in Education Josh Steele Matt Aguirre April 8, 2002

Some Elementary DP Examples

SelectionWhether or not (i.e. IF)Alternative Action (i.e. IF/ELSE)Unrelated choice (i.e. sequence of IFs)

RepetitionCounted Repetition Iterator Process All ItemsExtreme Values (find min/max in selection)

Page 10: Design Patterns in Education Josh Steele Matt Aguirre April 8, 2002

More Elementary Design Patterns

Client/ServerNo networking needed – as simple as calling a

method on an objectEssentially getting someone else to do work for you

Linked ListsFixed, Expandable, etc.Can be used to create other more complex patterns

(i.e. data structures)

Page 11: Design Patterns in Education Josh Steele Matt Aguirre April 8, 2002

Even More Elementary Patterns

Stylistic Patterns Braces – to line up or not? One-liners

If (a > 0) {flag = true;} else {flag = false;}

Declare-Construct-Initialize Declare type, Construct variable (type-name combo, ala C/C++) Initialize the variable

Declare-Define-Use Function prototype, definition, function call

Tons more!

Page 12: Design Patterns in Education Josh Steele Matt Aguirre April 8, 2002

“Too Simple!”

Primary Objectives: Introduce the principles of design early into a

programmer’s train of thought, starting from initial “problem to code” transition

Aid in the discovery of more complex patterns by drawing upon these design principles and putting patterns together

Help the novice student to learn!

Page 13: Design Patterns in Education Josh Steele Matt Aguirre April 8, 2002

To find out more…

The Elementary Patterns Homepage http://www.cs.uni.edu/~wallingf/patterns/elementary/

Joseph Bergin’s Homepage http://csis.pace.edu/~bergin/

Some other elementary patterns listings http://max.cs.kzoo.edu/~abrady/patterns/ProgrammingPatternsList.html http://csis.pace.edu/~bergin/papers/SimpleDesignPatterns.html

Teaching DS DPs [Gelfand] http://www.cs.brown.edu/cgc/jdsl/papers/patterns.pdf

Design Patterns [TheGangOfFour/GoF]