1 / 23

Hello PigWorld

Hello PigWorld. Raymond Lister University of Technology, Sydney. Pigworld. Boy Pigs and Girl Pigs. - Note the rope. Pig Controllers. Pig Food and Food Trees. When a boy meets a girl … . Before. After. Class Hierarchy: Complete – 41!. Animal / Vegetable / Mineral.

ralph
Download Presentation

Hello PigWorld

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. 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 … Before After

  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. Re-use Classes(Animae)

  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/ … • “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.

More Related