Overview
Labs included in this section are designed for a first course in object
oriented programming. They procede through the usual CS 1 topic set
with a relatively objects early approach. The language employed is Java,
specifically LeJOS for the Mindstorms platform.
The Turtle
The turtle is the standard RCX robot that these labs employ. The instructions
for its construction can be found on page 12 of the Robotics Invention
System 2.0 Manual. The sensor configurations we utilize in some of the
labs can be found on page 30 for the bump sensors, and page 34 for the
light sensor.
The Turtle Labs
These labs cover the kinds of syntactic and semantic concepts
that arise in a first programming class using Java. The labs are:
- Sequential Control: We
use sequential code to have the "Turtle" robot
to move in a few geometric figures. (Lab status: beta)
- Variables and Expressions: We
introduce some further Turtle abilities and use variables to create
more interesting shapes. (Lab status: beta)
- Methods: In this lab
we introduce the use of parameter-less methods to separate code into
parts and also the use of the Random class
in Java. (Lab status: beta)
- Methods with Parameters / Scope: We
dig deeper into the use of methods to abstract code into smaller, reusable
units using parameters and return values, we introduce global variables,
and we use the java.lang.Math class.
(Lab status: beta)
- Classes: We define
a class that allows musical notes and rests to be represented and played
back by the RCX. (Lab status: beta)
- Event Driven Programming: We
introduce the basics of event driven programming and then focus on
using decision structures to respond to events. (Lab status: beta)
- Loop Control Structures: We
work with each of the loop control structures that Java defines.
(Lab status: beta)
- Using Interfaces: We
define interfaces to run races and to draw figures with the robots.
(Lab status: beta)
- Array Structures: We
use arrays to record inputs from the user and then traverse a course,
using the recorded values to know when to move and when to turn. (Lab
status: beta)
- Navigation: We develop
a class that represents a gridded area, stores the robot's location
in the area and allows us to tell the robot to move to specific
grid locations. (Lab status: beta)
- Inheritance: We define
several classes that handle musical notes and rests, and an abstract
class that each is an extension of. (Lab status: beta)
- Sorting and Polymorphism: We
introduce polymorphism in the context of sorting algorithms. (Lab status: beta)
The dependencies between the labs are shown in the following diagram.
A relatively object-early approach to a CS 1 course could do the labs
in numeric order, while an objects late approach could do labs 6 and
7 (control structures) before lab 5 (classes), and could even do lab
6 (if statements) before introducing parameter-less methods (lab 3).
© 2001, 2004 by Scott Anderson, Frank Klassner, Pam Lawhead,
and Myles McNally. This work is supported by NSF grants 0088884 and 0306096. Permission
to use, copy, adapt and modify this lab for instruction purposes is granted.
These materials can be obtained from our web site
www.mcs.alma.edu/LMICSE. If you have suggestions
for improvement, please contact us via the web site; we would really appreciate
it. This file was last modified on
June 6, 2005.