Presentation is loading. Please wait.

Presentation is loading. Please wait.

OOP in Introductory CS Stephen Wong and “Zung” Nguyen Rice University Better students though abstraction.

Similar presentations


Presentation on theme: "OOP in Introductory CS Stephen Wong and “Zung” Nguyen Rice University Better students though abstraction."— Presentation transcript:

1 OOP in Introductory CS Stephen Wong and “Zung” Nguyen Rice University Better students though abstraction

2 A Struggling Pedagogy OO Overkill Duke Univ. Java Power Tools Northeastern Univ. OO Lab Project Univ. Wisconsin Etc., etc. Polymorphic Panelists Graphics-based OO Wiliams College Karel the Robot Univ. Waterloo and others OOPSLA OO Workshop

3 Old Intro CS at Oberlin CS 1 & 2 in Java Was procedural + a bit of OOP 3 rd semester in Scheme Problems Students knew syntax but not programming. A big conceptual jump into Scheme No experience with design. No large scale project experience. Non-inspiring course.

4 What can students do? Koch Curves Frogger, pretty Swarming/Flocking Simulation Movie loop, cute Multiple controllable threads Puzzle Game Frogger, extended Movie loop, techno Ballworld Animation Frogger, nuts Remote, distributed agents Client-server game

5 OO First? Myth: OO is an advanced concept. Students intrinsically understand polymorphism Students intrinsically understand object behaviors. Students intrinsically understand how objects interact Leverage what the students already understand! Definitely!

6 It’s not that easy… Concrete objects Abstract objects Concrete behaviors Abstract behaviors Learning abstract thinking is not easy. Abstraction the key to understanding CS

7 What is a Design Pattern? An abstracted solution to a class of problems. Describes relationships between objects Describes when and how those relationships can used. But why do they work? Design patterns are expressions of fundamental CS principles

8 The Road Concrete Objects Abstract Objects & Behaviors Polymorphism Strategies Encapsulation Recursion Visitors State Pattern Abstract Construction Factories Decoupling Adapters Decorators Lambda Calculus Anonymous classes Composition Delegation

9 AElement +accept(AVisitor v) +other methods… ElementA +accept(AVisitor v) ElementB +accept(AVisitor v) Example: Visitor Pattern Concrete Elements Abstractly Equivalent v.methodA(this);v.methodB(this); One method per element AVisitor +methodA(AElement e) +methodB(AElement e) Visitor1 +methodA(AElement e) +methodB(AElement e) Visitor2 +methodA(AElement e) +methodB(AElement e) Concrete Visitors Abstractly Equivalent Abstract, Invariant Data Structure Variant, Decoupled Algorithms

10 Visitors Teach… Decoupling of variant and invariant Polymorphic dispatching Encapsulation of a process Abstract equivalence If elements are empty vs. non-empty lists Visitor methods: base and inductive cases. Declarative style programming Design Patterns are tools to teach CS concepts

11 Design Patterns as Embodiments of Abstract Concepts Abstract behavior Decoupled behavior Recursion Abstract construction Strategy State Visitor Decorator Variant vs. Invariant Encapsulation Delegation Factory Composite MVC Adapter

12 The Role of Design Patterns Design Patterns Language of Abstraction Tangible Abstraction Focus on Abstraction

13 Example: Koch Curve Lab Koch -Point a,b +grow(AFactory f) +paint() DrawOneState grow(AFactory f) paint() DrawManyState grow(AFactory f) paint() CurveFactory +makeOne() +makeMany() SnowflakeFactory +makeOne() +makeMany() AKochState grow(AFactory f) paint() 1 LRStruct execute(IAlgo algo) 1 * GrowAlgo nullCase() nonNullCase() PaintAlgo nullCase() nonNullCase() 1 1 AFactory +makeOne() +makeMany() uses A curve between 2 pointsState Design Pattern Concrete States Base caseInductive caseComposite Pattern LRStruct Visitor Pattern Algorithms Base case construction Factory Design Pattern Inductive case construction Base case Inductive case Concrete Factories Only one line of code that actually grows/paints! Run program

14 Technology an Integral Part of the Pedagogy UML Diagramming Tool Integrated Development Environment Focus on design, not syntax Focus on the objects/classes, not the implementation Focus on the problem, not API Focus on the Abstraction!!

15 Plugging into the Students What is it that really interests our students? Games AI Roboti cs Graphic s “Real Programs” Networking

16 Getting the Students to Plug In Graphical Interfaces Simplicity + Power Unimagined capabilities Cutting edge technology Fun, fun, fun!!!

17 Synergy Focus on AbstractionDesign Patterns Development Tools Leveraged Student Experiences Rich Lab Experiences Cohesive Pedagogical Path Fundamental CS Principles Fun, inspiring results Learning Abstract Thinking. The best students ever. http://www.exciton.cs.rice.edu/cs150 http://www.exciton.cs.rice.edu/cs151 Demos


Download ppt "OOP in Introductory CS Stephen Wong and “Zung” Nguyen Rice University Better students though abstraction."

Similar presentations


Ads by Google