20
Using Jeroo To Teach Object- Oriented Concepts By Christian Digout

Using Jeroo To Teach Object-Oriented Concepts By Christian Digout

Embed Size (px)

Citation preview

Using JerooTo Teach Object-Oriented

ConceptsBy

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

Example of a Program

Features of the Jeroo ApplicationAnimation 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 JerooSmall Object-Oriented LanguageOnly one class, the Jeroo class Can instantiate up to four Jeroos Three attributes per Jeroo

◦location ◦direction ◦number of flowers

Summary of JerooSix constructors to initialize the

attributes Seven action methods Seven sensor methods to

examine the immediate surroundings

Four relative directions

InstantiationThe process of creating an

instance of an object.Jeroo has 6 constructors

◦Including a default constructorThe new operator is used to

instantiate objects

Constructors

Objects and JerooStates (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

Behavior and Member Methods

Behaviors and Member Members

Student AssignmentsFrom the Jeroo website:

◦Pick All Flowers◦The Maze◦Walk the Lake◦http://home.cc.gatech.edu/dorn/48

JerooUse of constructorsGet use to the dot-notationUse member methodsCan extend the Jeroo class with

new methods

Java – Building a Classpublic class Circle {

private static final double PI = 3.14;private double radius;

public Circle() {radius = 1;

}

public void setRadius(double newRadius) {

radius = newRadius;}

}

Jeroo ClassIt is written in JavaAsk students what would it

include?◦6 constructors◦Member variables◦Member methods

Turtle GraphicsGood for showing:

◦Composition “has a” relationships◦Inheritance “is a” relationships◦Interfaces◦Abstract classes

Turtle GraphicsCreate a Shape InterfaceAbstractShape 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 HierarchyCan 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