(SIPC) Helper Classes Lesson

Helper Classes

In the previous modules, you created a lot of code to create actions to perform specific behaviors. You should be able to transfer that knowledge to new situations.   Recognizing behaviors that are similar so you can reuse code is part of being a good programmer.  Being able to analyze code from other programs and recognize the parts that you can use to complete a task is an important problem solving skill that programmers learn.  

To help you in reusing code, Greenfoot has a created a set of Helper classes to make repetitive tasks easier to program. We created the SharedResources class in our FlyingBird program. These helper classes serve the same purpose. They allow you to write code once and reuse it in different classes. The Helper classes are created for specific purposes.

To access the Helper classes, from the Greenfoot environment menu, click Edit and Import Classes. You will see a list of all the Helper classes available for import. Click on the Helper class you want to use and click the Import button. It will place the helper class into your program.

The image below shows how to access the Helper classes from the Greenfoot environment menu and a list of the classes and their purpose. In the next lesson we will see how to use some of these Helper classes in creating a program.

Screenshot of Edit screen with 
"Import Class" selected

Import Class:
Animal
Counter
GifImage
Label
Map
ScoreBoard
Simple Timer
SmoothMover
Weather

In the next lesson, We'll look at some programs that use these classes and how they are helpful in building different programs.  

[CC BY 4.0] UNLESS OTHERWISE NOTED | IMAGES: LICENSED AND USED ACCORDING TO TERMS OF SUBSCRIPTION