130 likes | 142 Views
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.
E N D
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
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]
In Layman’s Terms • Design Patterns are: • Tools to help teach OOP and OOD • Concepts to help improve quality of OOP • Used to promote reuse • Help problem solving ability (“have I seen that problem before?”) • Tools to help communicate ideas • Other definitions?
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
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?
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)
How to use Elementary Patterns • Not as an exam question • Minimizes the impact! • As Tools to read, write and organize code • Vocabulary between students • Benchmark for code quality
Some Elementary DP Examples • Selection • Whether or not (i.e. IF) • Alternative Action (i.e. IF/ELSE) • Unrelated choice (i.e. sequence of IFs) • Repetition • Counted Repetition • Iterator Process All Items • Extreme Values (find min/max in selection)
More Elementary Design Patterns • Client/Server • No networking needed – as simple as calling a method on an object • Essentially getting someone else to do work for you • Linked Lists • Fixed, Expandable, etc. • Can be used to create other more complex patterns (i.e. data structures)
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!
“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!
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]