Teaching AP Computer Science A with the Finch

The Finch can be used with Java in a number of programming environments. For more details, check out this page on setting up the Finch with Java.

Java Basics

Students can use the Finch from the very beginning of AP computer science. Dance! and Indiana Finch (Level 1) are simple assignments that can be used to introduce students to the Finch methods. There is even a Hello World assignment for the Finch! 

The fundamentals of variables and arithmetic operators can be incorporated into an assignment such as Finch Theremin (Note: This assignment also requires a loop). In this project, students must scale the values of the light sensors to set the frequency and volumes of tones.

Control Structures

Loops and decision statements are essential for working with the Finch sensors. In the Confused Wanderings assignment, students can use while loops to move around a room while avoiding obstacles. The Indiana Finch (Level 2) assignment uses while loops, and the Finch Security assignment can incorporate both while and for loops. License to Fly and The Beegide Finch are good assignments for decision statements.

More complex assignments often require nested control structures. For example, Hill Climber requires complex Boolean logic and a decision statement nested within a while loop. Simple Simon Says required nested decision statements. Finally, while the switch statement is not included in the AP Java subset, this statement can be quite useful with the Finch, as shown in Finch Remote Control.

Standard Classes

Standard classes, such as the Math and String classes, are required for a number of Finch assignments. For example, in the Song Player assignment, students write a class that uses a String to represent a song for the Finch to play. They must parse this String into individual notes and play the correct tone for each note. Finch Spinner is a simple application of the random() method in the Math class, and Finch Timer requires that students use Math methods to calculate the magnitude of the Finch’s acceleration.

Arrays and Lists

The Finch can be used to collect data, which provides a natural application for arrays and lists. In the Finch Data Collector I assignment, students collect data from the Finch light sensors. This can be done using two arrays or two lists. In the Finch Data Collector II assignment, students collect data over time and store it in a two-dimensional array. They then save this data in a file that can be imported by a spreadsheet program.

In addition, lists can be used to create games or other ways of interacting with the Finch. In the Finch Plays Simon assignment, students must use a list to keep track of the movements the user should make. In the Gestural Programmer, students must record a series of tilts and then use this to produce movement of the robot.

Fundamentals of Classes

In Java, the functionality of the Finch robot is encapsulated in the Finch class, which can be used as an example of classes in general. While using the Finch, students will learn how to declare an instance of an object and to use different methods within a class. The Finch Controls Finch assignment, in particular, is an excellent example of two instances of a single class. In this assignment, one Finch is used to control another.

As they work with the Finch class, students will gain an understanding of how a large class with many methods might be organized. This experience will help them as they begin to write their own classes. The Finch methods also provide many examples of overloading. For example, the setLED() method has four different definitions with different sets of parameters.

Students can also write their own classes that use the Finch class. For example, the Finch Visits a Farm assignment requires that students use the Finch to write a custom class that mimics different farm animals.

Inheritance and Interfaces

With inheritance, students can create their own customized versions of the Finch class. For example, in the Moody Finch assignment, students extend the Finch class to give the Finch emotions. Finch Visits a Farm could also be written as an extension of the Finch class. Please note that the Finch class is declared as final in the default version of finch.jar. To complete assignments that require inheritance, you will need to replace finch.jar with the version in this folder. On a Mac, you will also need to replace jnaerator-0.9.5.jar, libhidapi32.dylib, and libhidapi64.dylib. While the Gridworld case study is no longer required material for AP Computer Science A, it is a valuable example of classes and inheritance. Gridworld can be extended to include the Finch; some examples are given in Gridworld and the Happy Finch.

Students can also use the Finch to implement an interface for mobile robots. For example, the Robot Interface assignment requires students to implement an interface to move the robot and read sensor data.

Recursion, Searching, and Sorting

The Finch can be used as a display to demonstrate recursion. For example, in the Finch Fractals assignment, students must use recursion to make the Finch draw Koch fractals. Finch projects involving arrays and lists can be extended to incorporate algorithms for searching and sorting. For example, the Finch Data Collector I assignment can be extended to have students sort the data arrays to find the maximum and minimum values.

Other Topics

If time permits, a number of other interesting topics can be covered with the Finch. For example, students can investigate playing music in Java using the Finch Dances to Midi assignment. If you choose to cover graphical user interfaces, students can create a GUI to control the Finch, as in Finch Slider Control. Students can also use the Finch as a controller for a game with a GUI, as in Finch as Game Controller.

Several readers for RSS feeds are included with the Finch Java class. These readers can be used to create programs that enable the Finch to interact with websites. For example, the Finch Weatherpersonality assignment requires students to make the Finch report the weather at a given location. The News with the Finch assignment uses the Finch to search for news stories for a given word or phrase. Students can even create an RSS feed for their Twitter account so that the Finch can interact with it, as in Finch Tweets.