1 / 17

OOP in Introductory CS

OOP in Introductory CS. Better students though abstraction. Stephen Wong and “Zung” Nguyen Rice University. A Struggling Pedagogy. Java Power Tools Northeastern Univ. Karel the Robot Univ. Waterloo and others. Graphics-based OO Wiliams College. OO Lab Project Univ. Wisconsin.

malo
Download Presentation

OOP in Introductory CS

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


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

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

  3. Old Intro CS at Oberlin • CS 1 & 2 in Java • Was procedural + a bit of OOP • 3rd 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 Client-server game Multiple controllable threads Remote, distributed agents Frogger, pretty Frogger, extended Ballworld Animation Frogger, nuts Puzzle Game Movie loop, cute Swarming/Flocking Simulation Movie loop, techno

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

  6. Learning abstract thinking is not easy. Abstraction the key to understanding CS Abstract objects Abstract behaviors It’s not that easy… Concrete objects Concrete behaviors Intro CS must focus on learning Abstraction!

  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. Polymorphism Abstract Objects & Behaviors Delegation Strategies Composition Encapsulation Factories State Pattern Visitors Abstract Construction Adapters Decorators Anonymous classes Recursion Lambda Calculus Decoupling The Road Concrete Objects

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

  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. Strategy Adapter Decorator State Visitor Factory Composite MVC Design Patterns as Embodiments of Abstract Concepts Abstract behavior Encapsulation Delegation Variant vs. Invariant Abstract construction Decoupled behavior Recursion

  12. TangibleAbstraction Languageof Abstraction Focus on Abstraction The Role of Design Patterns Design Patterns

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

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

  15. Plugging into the Students What is it that really interests our students? Robotics AI Games Networking Graphics “Real Programs”

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

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

More Related