OOP in Introductory CS Stephen Wong and “Zung” Nguyen Rice University Better students though...
-
Upload
drusilla-wright -
Category
Documents
-
view
215 -
download
0
Transcript of OOP in Introductory CS Stephen Wong and “Zung” Nguyen Rice University Better students though...
![Page 1: OOP in Introductory CS Stephen Wong and “Zung” Nguyen Rice University Better students though abstraction.](https://reader036.fdocuments.us/reader036/viewer/2022072114/56649efa5503460f94c0c55b/html5/thumbnails/1.jpg)
OOP in Introductory CS
Stephen Wong and “Zung” Nguyen
Rice University
Better students though abstraction
![Page 2: OOP in Introductory CS Stephen Wong and “Zung” Nguyen Rice University Better students though abstraction.](https://reader036.fdocuments.us/reader036/viewer/2022072114/56649efa5503460f94c0c55b/html5/thumbnails/2.jpg)
A Struggling Pedagogy
OO OverkillDuke Univ.
Java Power ToolsNortheastern Univ.
OO Lab ProjectUniv. Wisconsin
Etc., etc.
Polymorphic Panelists
Graphics-based OOWiliams College
Karel the RobotUniv. Waterloo and others
OOPSLA OO Workshop
![Page 3: OOP in Introductory CS Stephen Wong and “Zung” Nguyen Rice University Better students though abstraction.](https://reader036.fdocuments.us/reader036/viewer/2022072114/56649efa5503460f94c0c55b/html5/thumbnails/3.jpg)
Old Intro CS at OberlinCS 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 SchemeNo experience with design.No large scale project experience.Non-inspiring course.
![Page 4: OOP in Introductory CS Stephen Wong and “Zung” Nguyen Rice University Better students though abstraction.](https://reader036.fdocuments.us/reader036/viewer/2022072114/56649efa5503460f94c0c55b/html5/thumbnails/4.jpg)
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
![Page 5: OOP in Introductory CS Stephen Wong and “Zung” Nguyen Rice University Better students though abstraction.](https://reader036.fdocuments.us/reader036/viewer/2022072114/56649efa5503460f94c0c55b/html5/thumbnails/5.jpg)
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!
![Page 6: OOP in Introductory CS Stephen Wong and “Zung” Nguyen Rice University Better students though abstraction.](https://reader036.fdocuments.us/reader036/viewer/2022072114/56649efa5503460f94c0c55b/html5/thumbnails/6.jpg)
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
![Page 7: OOP in Introductory CS Stephen Wong and “Zung” Nguyen Rice University Better students though abstraction.](https://reader036.fdocuments.us/reader036/viewer/2022072114/56649efa5503460f94c0c55b/html5/thumbnails/7.jpg)
What is a Design Pattern?An abstracted solution to a class of
problems.Describes relationships between objectsDescribes when and how those relationships
can used.
But why do they work?
Design patterns are expressions
of fundamental CS principles
![Page 8: OOP in Introductory CS Stephen Wong and “Zung” Nguyen Rice University Better students though abstraction.](https://reader036.fdocuments.us/reader036/viewer/2022072114/56649efa5503460f94c0c55b/html5/thumbnails/8.jpg)
The RoadConcrete Objects
Abstract Objects & Behaviors
Polymorphism
Strategies
Encapsulation
Recursion
VisitorsState PatternAbstract Construction
Factories
Decoupling
AdaptersDecorators
Lambda Calculus
Anonymous classes
Composition
Delegation
![Page 9: OOP in Introductory CS Stephen Wong and “Zung” Nguyen Rice University Better students though abstraction.](https://reader036.fdocuments.us/reader036/viewer/2022072114/56649efa5503460f94c0c55b/html5/thumbnails/9.jpg)
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
![Page 10: OOP in Introductory CS Stephen Wong and “Zung” Nguyen Rice University Better students though abstraction.](https://reader036.fdocuments.us/reader036/viewer/2022072114/56649efa5503460f94c0c55b/html5/thumbnails/10.jpg)
Visitors Teach…Decoupling of variant and invariantPolymorphic dispatchingEncapsulation of a processAbstract 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
![Page 11: OOP in Introductory CS Stephen Wong and “Zung” Nguyen Rice University Better students though abstraction.](https://reader036.fdocuments.us/reader036/viewer/2022072114/56649efa5503460f94c0c55b/html5/thumbnails/11.jpg)
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
![Page 12: OOP in Introductory CS Stephen Wong and “Zung” Nguyen Rice University Better students though abstraction.](https://reader036.fdocuments.us/reader036/viewer/2022072114/56649efa5503460f94c0c55b/html5/thumbnails/12.jpg)
The Role of Design Patterns
DesignPatterns
Languageof Abstraction
TangibleAbstraction
Focus onAbstraction
![Page 13: OOP in Introductory CS Stephen Wong and “Zung” Nguyen Rice University Better students though abstraction.](https://reader036.fdocuments.us/reader036/viewer/2022072114/56649efa5503460f94c0c55b/html5/thumbnails/13.jpg)
Example: Koch Curve LabKoch-Point a,b+grow(AFactory f)+paint()
DrawOneStategrow(AFactory f)paint()
DrawManyStategrow(AFactory f)paint()
CurveFactory+makeOne()+makeMany()
SnowflakeFactory+makeOne()+makeMany()
AKochStategrow(AFactory f)paint()
1
LRStructexecute(IAlgo algo)
1
*
GrowAlgonullCase()nonNullCase()
PaintAlgonullCase()nonNullCase()
1 1
AFactory+makeOne()+makeMany()
uses
A curve between 2 points State Design Pattern
Concrete States
Base case
Ind
uctive case
Com
posite P
attern
LRStruct Visitor Pattern Algorithms
Base case construction
Factory Design Pattern
Inductive case construction
Base caseInductive case
Concrete Factories
Only one line of code that
actually grows/paints!
Run program
![Page 14: OOP in Introductory CS Stephen Wong and “Zung” Nguyen Rice University Better students though abstraction.](https://reader036.fdocuments.us/reader036/viewer/2022072114/56649efa5503460f94c0c55b/html5/thumbnails/14.jpg)
Technology an Integral Part of the Pedagogy
UML Diagramming Tool
Integrated DevelopmentEnvironment
Focus on design,
not syntax
Focus on the objects/classes, not the implementation
Focus on the problem,
not API
Focus on the Abstraction!!
![Page 15: OOP in Introductory CS Stephen Wong and “Zung” Nguyen Rice University Better students though abstraction.](https://reader036.fdocuments.us/reader036/viewer/2022072114/56649efa5503460f94c0c55b/html5/thumbnails/15.jpg)
Plugging into the StudentsWhat is it that
really interests our students?
Games
AIRoboti
cs
Graphics
“Real Programs”
Networking
![Page 16: OOP in Introductory CS Stephen Wong and “Zung” Nguyen Rice University Better students though abstraction.](https://reader036.fdocuments.us/reader036/viewer/2022072114/56649efa5503460f94c0c55b/html5/thumbnails/16.jpg)
Getting the Students to Plug In
Grap
hical In
terfaces
Sim
plic
ity +
Pow
er
Unim
agined capabilities
Cutting edge technologyFun, fun, fun!!!
![Page 17: OOP in Introductory CS Stephen Wong and “Zung” Nguyen Rice University Better students though abstraction.](https://reader036.fdocuments.us/reader036/viewer/2022072114/56649efa5503460f94c0c55b/html5/thumbnails/17.jpg)
Synergy
Focus on AbstractionDesign Patterns
Development Tools
Leveraged Student Experiences
Rich Lab Experiences
Cohesive Pedagogical Path
Fundamental CS Principles
Fun, inspiring results
LearningAbstractThinking.
The best students
ever.
http://www.exciton.cs.rice.edu/cs150http://www.exciton.cs.rice.edu/cs151
Demos