CIT 597 Assignment 1: Browser Helper
Fall 2003, David Matuszek
10:30-12:00 MW, Towne 309
Blackboard (requires login)

Purposes of this assignment:

The General Idea:

When I'm researching a topic, I'd like to be able to bookmark the interesting pages that I find, along with a short description of each. While it's easy enough to save "bookmarks" ("favorites") in a browser, no browser that I know of allows me to add a description.

Ideally, I'd like to have a web browser that, whenever I bookmark a page, offers me the chance to enter a brief description. And, of course, I'd like the usual feature of being able to put the bookmark into one of several categories that I define.

Unfortunately, writing an entire web browser is too large for a project that is only supposed to take a week or so. Besides, I already have several browsers, so why do all that work just to recreate what I already have? Instead, I'd like to (almost) follow the Extreme Programming dictum, "Do the simplest thing that could possibly work," and write a standalone program to keep these notes for me.

The User Story:

In Extreme programming, instead of starting with a "design document" that tells exactly what the program is and what it does, we start with a "user story" that tells what the user is going to do with the program.

Here's my "user story":

I'm in my browser, and I'm looking for articles on (say) Extreme Programming. I find one that's interesting, say http://www.extremeprogramming.org/. I decide to keep track of this site.

I open my program. The first thing it does is open a dialog box and ask me for a file to use. I don't have a file yet (if I did, I would just open it), so I navigate to where I want to keep my new file, and create it there, with the name extreme_programming. Since this is a new file, the program asks me for a title, and I type in "Extreme Programming".

The program opens a window containing some text fields. I copy the URL and paste it into the field labeled URL. I copy and paste the title of the page, "Extreme Programming: A gentle introduction." into the field labeled Title--or, better yet, I click a Get Title button and the program goes to that URL and copies the <title>...</title> text from the HTML into this field, which I can then edit if I like. Finally, into a Description field, I type: "Many short pages, with a clickable graph of the XP process. Links are in red. Popular, but too unstructured for beginners." Then I click an OK button.

In my browser, I wander around a bit more until I find http://www.jera.com/techinfo/xpfaq.html. My program is already open, so I just enter the necessary information into the fields and click OK. Each time I click OK, my program saves all its information as an HTML file (see below), so I don't have to remember to save my work before I quit the program. (I can quit the program by clicking its close box in the top right corner.) Just so I can feel comfortable that the program is working, it will display some kind of summary of what I've done so far, and update it each time I click OK.

Tomorrow, if I want to continue looking for articles on Extreme Programming, I start my program, open my file, and continue adding things.

Finally, whenever I want to look up these pages again, I just use my browser to open the page that my program has created (extreme-prgramming.html). The page will look something like this:

Extreme Programming

Extreme Programming: A gentle introduction.
Many short pages, with a clickable graph of the XP process. Links are in red. Popular, but too unstructured for beginners.
Extreme Programming FAQ
Although this is called a FAQ, it's really a brief introduction to XP done in question-and-answer format.

That's my "user story." Since I am your customer, your job is to write a program that does the above, or something very like the above.

Notice that this is almost "the simplest thing that could possibly work." The only fancy feature that I'm asking for is the Get Title button, which requires your program to actually read the page from the URL and extract the information in the <title> tag. In fact, my real reason for requiring this is to force your program to use the URL class to read in and process a page from the web--otherwise, this program would be suitable for a first course in Java (such as CIT591).

Two things we might want to add to the program are the ability to delete URLs again, and the ability to edit them. Don't do this. Another Extreme Programming tenet is YAGNI: "You aren't gonna need it." That is, don't add functionality you think you will need, but wait until you actually need it.

Editing and deleting URLs is a good example of YAGNI--you can see that these features might be useful, but it adds a lot of programming effort, and chances are you'll never use them. If you really want to edit or delete a couple of URLs, you can do this in a text editor a lot faster than you can write a program to do it for you. If someday you find yourself spending so much time hand-editing the HTML file that it would be less work to just add editing and deletion features to your program, that's the time it becomes appropriate to expand the program.

Additional requirements:

Your program should (of course) have good style and be well commented (with javadoc comments). This isn't an exception to YAGNI--you always need good style and good comments. If you habitually use good style and comment your code, this reduces the amount of time required to get your program working.

Your program should be user friendly. This isn't a big, complicated program; it should be obvious how to use it. The user shouldn't have to go through menus or click the mouse a lot. Make the window big enough to use comfortably, but no bigger (and the user should be able to resize it in the usual way). Check if the user typed the file name with a .html suffix, and if not, add it automatically.

Due date:

Wednesday, September 17, before midnight. Turn in a zipped file via Blackboard.