Re-imagining CS1/CS2 with Android Using the Sofia Framework

A workshop at SIGCSE 2013.

Stephen Edwards (with help from Tony Allevato)

Android has seen increased use in introductory CS courses to motivate and excite students about their programming assignments, but using the standard Android libraries as a GUI platform in CS2 presents numerous challenges and using it in CS1 is nearly impossible. This workshop introduces participants to Sofia, the Simplified Open Framework for Innovative Android Applications. Sofia abstracts out many advanced concepts normally required to develop interesting applications, using a unique approach to event handling, binding GUI elements to Java code, and user interaction. The goal is to allow students to focus entirely on using Java programming skills to solve problems in the application domain, instead of writing monotonous glue code typically required to construct an Android application.

Although this workshop is not a hands-on workshop, I anticipate that many of you may wish to try out some of the examples we present during (or after) the workshop. As a result, there is one pre-workshop action you can take to make sure you are set up to run the examples: install Eclipse and the Android Software Development Kit.

Fortunately, Google has streamlined this process and the most recent version of the Android SDK comes with everything you need, right in one download. You can follow the instructions we give to our students (you can skip the "Configuring Eclipse" section, which gives students course-specific instructions for our class):

Getting Started with Android (Chapter 1 of the CS2 materials listed later on this page)

In addition to the basic download/install instructions, this page includes details on how to create a virtual device (so you can run Android code in emulation on your own PC), and enabling application debugging on your own Android phone or tablet, if you have one.

That should get you set up to run the Sofia examples we'll show in the workshop. Feel free to poke around and look at the other chapters available in our CS2 e-book, including the gallery or student projects that it includes. That will give you an overview of a number of concepts we'll be working with in the workshop, as well as a flavor of what our students learn about.

Sofia-workshop-sigcse2013.pdf contains all of the presentation slides used at the workshop. contains all of the code examples presented at the workshop. To view the examples, download the zip and unpack it someplace convenient. Then open Eclipse, and use the File->Import... command and choose "Existing Projects into Workspace". In the resulting dialog, navigate to the place where you unpacked the examples, and select all of the directories that were contained in the zip file to import them into your workspace.

The documentation we give to students in our CS2 course regarding Sofia is mostly contained in an electronic "book". Here are links to all of the sections currently in the book:

Sofia the Simplified Open Framework for Innovative Android Applications
Gallery Apps and Games from Former Students
Chapter 1 Getting Started with Android
Chapter 2 Structure of an Android Application
Chapter 3 Basic GUI-driven Apps
Chapter 4 Testing GUI Apps (under construction)
Chapter 5 Advanced Graphics
Appendix A Sofia API Documentation (Javadoc)

In CS1, we start students out with a modified version of Greenfoot that uses a micro-world library layered on top of Sofia. The documentation we give to students in our CS1 course is also contained in an electronic "book", one that is based heavily on the Jeroo project produced by Brian Dorn and Dean Sanders. Here are links to all of the sections currently in the book:

Objects First: A brief introduction to object-oriented programming using Java to build simple Android applications
Chapter 1 What's a Micro-World?
Chapter 2 A Programmable Light-Bot in Java
Chapter 3 The Jeroos of Santong Island
Chapter 4 Problem Solving and Algorithms
Chapter 5 Creating and Using Jeroo Methods
Chapter 6 Conditionally Executing Actions
Chapter 7 Repeating Actions
Chapter 8 Handling Touch Events
Chapter 9 Adding Text to the Screen