Carnegie Mellon University

GridCity Project

GridCity Programming

An Introduction to Programming (in Java)


GridCity is an add-on to Java that allows new programmers to write Java programs that control vehicles in a graphical world. Programs typically instruct vehicles to move around as well as to pickup and deliver parcels. Powerful feats can be accomplished in such programs such as searching and sorting (see examples). Also, different programming paradigms can be explored such as stepwise refinement and object-oriented programming. Below is an example of a GridCity program in operation. Click on the run button and the vehicles will arrange parcels to spell hi. (See more examples)

0 1 2 3 4 5 6 7 8 Avenues

GridCity Advantage

A primary advantage of this approach is that programmed actions are visible on the screen during operation. Errors in intent (such as a vehicle moving in the wrong direction) and errors in execution (such as a vehicle crashing into a wall) can be easily seen. This approach is in sharp contrast to traditional programming where programmed actions take place inside the computer and are not easily visible. (See comparison of related programming environments for Pascal, C and C++).

Using the GridCity programming environment, students can be gradually introduced to algorithmic thinking within a Java programming environment. As a result, GridCity can be used as a preliminary introduction at the beginning of a programming course; or alternatively, GridCity can be used alone as an introductory course on solving problems by programming. Contents of such a course could include: program format, types of errors, grouping instructions, conditionals, loops, recursion, classes, methods, inheritance, threads and algorithmic thinking. (See on-line course, see on-line tutor)

Example Programs

Related Courses


Related links at this site

Related links at (CMU)

Brought to you by

Heinz School logo

H. John Heinz III School of Public Policy
at Carnegie Mellon University (CMU)

Principal Investigator: Latanya Sweeney, Ph.D.

Contact Information

Summer 1999 GridCity, ActiveTutors []