Presentation is loading. Please wait.

Presentation is loading. Please wait.

Hello PigWorld Raymond Lister University of Technology, Sydney.

Similar presentations


Presentation on theme: "Hello PigWorld Raymond Lister University of Technology, Sydney."— Presentation transcript:

1 Hello PigWorld Raymond Lister University of Technology, Sydney

2 Pigworld

3 Boy Pigs and Girl Pigs - Note the rope

4 Pig Controllers

5 Pig Food and Food Trees

6 When a boy meets a girl … BeforeAfter

7 Class Hierarchy: Complete – 41!

8 Animal / Vegetable / Mineral

9 Model / View / Controller Views largely explain the plethora of classes Students don’t generally read them. Only one controller class, “AnimalController”

10 Transcending the dialectic In the procedural style, algorithms are encoded explicitly within the methods of an object, but … in the object oriented style, algorithms emerge implicitly from the interactions between objects.

11 Find the minimum/maximum: the one essential procedural algorithm while ( not finished ) { get next element; if ( smaller/larger than previous best ) remember this new best element; } Algorithm originally taught without reference to PigWorld, as finding the minimum / maximum of a sequence of inputted numbers. Students then adapt basic algorithm to uses within PigWorld (e.g. radar and look for food)

12 Note! Not banning all algorithms more sophisticated than finding minimum / maximum. More sophisticated algorithms may be implemented as interactions between objects. … for example …

13 Dijkstra and the “Oink” Algorithm “Oink” is Dijkstra’s shortest path algorithm. Of the students who attempted the assignment, 88% completed this task (ie. 42% of class).

14 By the way … Emphasize message passing between instances of the same class to reinforce basic concepts (especially class vs. object) Transmission of sound does that nicely

15 Rope and Linked Lists Doubly linked list. Students given code to play out rope. Assignment task was to destroy the rope of a pig. Of those who attempted the assignment, 82% completed this task (ie. 39% of class). Recursion NOT required. Done by message passing.

16 Once again … Emphasize message passing between instances of the same class to reinforce basic concepts (especially class vs. object) Destroying rope does that nicely

17 Teach Linked Lists before Arrays Teaching linked lists early reinforces: –Message passing –Objects versus classes Arrays are a distraction from the above key concepts: –Come with their own syntax

18 Re-use Classes (Animae)

19

20 Want to Know More? Lister, R. (2004). Teaching Java First: Experiments with a Pigs-Early Pedagogy. Sixth Australasian Computing Education Conference (ACE2004). Dunedin, New Zealand. January 18-22. pp. 177-184. In the ACM Digital Library. Email me if you’d like to have the code.

21 c.f. Greenfoot http://www.greenfoot.org/ …http://www.greenfoot.org/ “Consider greenfoot as a combination between a framework for creating two-dimensional grid assignments in Java and an integrated development environment (class browser, editor, compiler, execution, etc.) suitable for novice programmers.” The existing implementation of PigWorld is a little clunky; a re-implementation within Greenfoot would be ideal.

22 Conclusion (1): Assignment design principles Emphasize message passing between instances of the same class to reinforce basic concepts (especially class vs. object) Use only simple loops that search for smallest or largest values in a sequence. Teach linked lists before before arrays. Ideally, don’t even teach loops in semester 1 Reuse classes

23 Conclusion (2): Transcend the OO vs. Procedural dialectic In the procedural style, algorithms are encoded explicitly within the methods of an object, but … in the object oriented style, algorithms emerge implicitly from the interactions between objects.


Download ppt "Hello PigWorld Raymond Lister University of Technology, Sydney."

Similar presentations


Ads by Google