200 likes | 463 Views
Using Jeroo To Teach Object-Oriented Concepts. By Christian Digout. What is Jeroo ?. A tool for helping students learn object-oriented concepts including : Instantiating and using objects Constructors Writing methods to extend behavior Information Hiding. Jeroo Layout.
E N D
Using JerooTo Teach Object-Oriented Concepts By Christian Digout
What is Jeroo? • A tool for helping students learn object-oriented concepts including: • Instantiating and using objects • Constructors • Writing methods to extend behavior • Information Hiding
Features of the Jeroo Application • Animation showing Jeroos moving around the island • Source code highlighting synchronized with execution • Stepwise or continuous execution mode • Choice of execution speeds • Ability to switch between execution modes and change speeds at will • Error messages
Summary of Jeroo • Small Object-Oriented Language • Only one class, the Jeroo class • Can instantiate up to four Jeroos • Three attributes per Jeroo • location • direction • number of flowers
Summary of Jeroo • Six constructors to initialize the attributes • Seven action methods • Seven sensor methods to examine the immediate surroundings • Four relative directions
Instantiation • The process of creating an instance of an object. • Jeroo has 6 constructors • Including a default constructor • The new operator is used to instantiate objects
Objects and Jeroo • States (or member variables) • Position (x, y) • Direction (North, East, South, West) • Number of flowers • Information Hiding • A Jeroo’s data is protected • Protects data integrity • Need to use member methods to access member variables
Student Assignments • From the Jeroo website: • Pick All Flowers • The Maze • Walk the Lake • http://home.cc.gatech.edu/dorn/48
Jeroo • Use of constructors • Get use to the dot-notation • Use member methods • Can extend the Jeroo class with new methods
Java – Building a Class public class Circle { private static final double PI = 3.14; private double radius; public Circle() { radius = 1; } public void setRadius(double newRadius) { radius = newRadius; } }
Jeroo Class • It is written in Java • Ask students what would it include? • 6 constructors • Member variables • Member methods
Turtle Graphics • Downloaded from: • http://www.cengage.com/cgi-wadsworth/course_products_wp.pl?fid=M20bI&product_isbn_issn=9780619267230 • Part of textbook resources for: • Fundamentals of Java by Lambert/Osbourne • Allows students to create simple graphics using Java
Turtle Graphics • Good for showing: • Composition “has a” relationships • Inheritance “is a” relationships • Interfaces • Abstract classes
Turtle Graphics • Create a Shape Interface • AbstractShape can implement Shape • Can implement members that would be the same for all shapes such as: • X and Y coordinates • Move function • Abstract methods would be: • Area • Draw
Shape Hierarchy • Can implement Circle and Rectangle Classes with students. • Extend Abstract Shape • Assignment: • Students implement a Triangle Class • Students can add a Perimeter Method to the hierarchy