CS 257: Software Design

Weather Display

For many years, a small weather station on the top of Carleton's Olin Hall has been collecting information about temperature, humidity, pressure, wind speed and direction, rainfall, etc. In the early nineties, when I first became aware of the weather station, it was dumping its data onto a hard disk attached to a Macintosh SE, and few people outside the physics department were aware it existed at all. A few years ago, however, Doug Foxgrover (then in the physics department, and now in ITS) supervised some students and an intern in the creation of a web interface for the Carleton weather station. Ultimately, this web site will give access to the past century's worth of weather data. For now, it is a wonderful and addictive tool for looking at local weather patterns during the past five years or so.

Undoubtedly, there are thousands of small local weather stations with some kind of web presence. For this assignment, you are going to write a Java or Python program to collect data from at least two such sites and display it in real time.

Your program

When your program starts up, it will start collecting temperature data from your selected weather sites. Carleton's site, for example, updates approximately once every five minutes, so your program should reload data from weather.carleton.edu once every five minutes or so. For your other site(s), you should choose source data that is also updated frequently.

Your program should display, in a reasonably compact window:

You will need to display this information for all of your locations. You can do this either by giving the user a way to select the location, or by showing both locations side by side, or some other way you consider suitable.

What to hand in

Hand in source code and a readme. The readme should explain your class design, your command-line syntax, and the status of your program.

Notes and suggestions

We will be doing another round of code reviews with this program, but not a rewrite.

This assignment is intended to give you practice in many aspects of software development, but especially in the area of object-oriented design. In this problem, several important objects and relationships between objects come to mind naturally. For example, you should probably have some sort of class that has responsibility for contacting a web site and collecting the data. This class might well act as the Subject in an Observer pattern, and should thus arrange for either the pushing or pulling of data. This or some other class will also need some sort of timer mechanism to cause it to contact the weather site for data.

One of the main goals of your design should be ease of extensibility. For example, if somebody were to ask you to add a new weather data source to the program, how hard would it be to do so? Similarly, if you wanted to add humidity to the display, how hard would that be?

I strongly urge you to spend a lot of time up-front developing a design for your program. What classes do you need, and how many instances of each? What responsibilities will these classes have? Is inheritance an appropriate tool, or should you be using composition? Where? Are there design patterns that would apply to this situation? Which ones, and how?

In fact, I encourage you to develop designs with each other, in pairs or even larger groups. As I said above, I want you each to do your own implementation, but group-generated designs are welcome. Don't forget to credit your co-workers in your code and/or documentation.

While you are working carefully on your design, you can also do some prototyping and bottom-up kinds of coding. For example, you will need to figure out how to use timers, and how to get the source for a given web page, and how to draw lines and text in a window. You will also need to parse the HTML results you retrieve from the various web sites, so an exploration of Java's or Python's text-parsing and regular expression support is in order. These are problems that you can work on in small experimental programs before your overall design is ready, because you know you will need to solve them eventually.

Here's a small gift for you--a simple Java program that retrieves a web file, and something similar for Python.

Start early (really!), have fun, and keep in touch.