CS 0007 Project, Fall 2009
Facebooklet

Partners

You may do the assignment with a partner or alone. In either case, please complete the partner sign-up sheet before the due date. The signup form is here. If you are not working with a partner, please enter "none" for your partner.

Only one partner should submit the assignment so that we don't get confused about what to grade!

Both of you should do the entire assignment, and work together to create your final solutions. You'll both need the experience/practice to prepare you for the exams.

Purpose

The project brings together everything you've learned this term to build something that we hope you'll be proud of: a mini version of a social network such as Facebook.

Note that this project is structured in two parts: a basic set of requirements, and a potential bonus of up to 10 points for adding enhancements of your choosing.

Basic requirements

We will lay out the basic operations your program must provide, but you will get to decide (1) how to handle all the "border" conditions that may arise and (2) what to print.

First of all, a few comments about things your program does *not* need to do (unless you choose some aspect of this for your enhancements):

Information

Your program must keep track of the following information about each member:

Your program must keep track of one member who is the current member -- the one whose profile is being displayed.

Upon startup, there is no current member, but operations like adding a new member naturally make someone the current member. Exactly how the operations affect the who is the current member will be up to you.

Pickling The Results

So that you do not need to build up a social network each time you run the program, use "cPickle" to save all member profile information in a file, and then load that file when restarting the program. Program "a3sol_3.py" has an example of using cPickle.

User Interface

Your program must display all the profile information for the current member. (In the case of the member's profile photo, it should display the picture itself, rather than the name of the file.) Note that not all of the data may be present for some members, perhaps because they have just joined and not yet set up their photo, status or friends list.

In addition to displaying profile information, your program must also provide feedback on the results of the operations the user performs. For example, if the user tries to add a new member with a name that is already in the system, it might display the message "Sorry -- that name is already in use. Try again." It will be up to you to decide how you want to handle all the situations that may arise, except in the few cases where we specify the behavior.

Operations

Your program must provide the operations below to the user. Note that these operations generally require (1) an update to the display, and (2) an update to your data structures that are recording things like who is friends with whom.

Enhancements

We have provided you with a baseline description of the application. You will decide how challenging to make this assignment by extending your application with new features ("enhancements") of your choice. These enhancements will be worth the final 10% of your project grade.

The additional features you implement could be practically anything! Here are a few suggestions:

To receive credit for you enhancements, you must submit a written description that explains how your enhancements went beyond the baseline requirements. Submit your description in a plain text file named enhancements.txt. (To ensure that your file is in plain text, you should use Wing as your editor.) Your submission should not exceed 150 words.

Suggested milestones

To help you break the project down and keep on track, here is a series of suggested milestones.

Milestone 1: Settle the specifications and plan your enhancements

The specifications provided tell you what operations your program must provide, but not all the details of how it should behave under every circumstance. Go through all of the operations and make those decisions. For example, if the user wants to go to the profile of a non-existent member, what system status message should be displayed, will your program ask to add them as a new user? Write all your decisions down.

Next, plan what your enhancements will be. If you have ambitious plans, you would be wise to have some simpler enhancements in mind, just in case you get behind.

Finally, you should work with your partner to create a schedule for milestone completion.

Milestone 2: Design your interactions with the user

What messages will be displayed to the user? What input will your program prompt the user for? For many of the user inputs, you will need a command associated with them. Define the command and if it will require a new function to call, actually write out the def and the docstring for that function. For now, the body of each of these functions can just be a print statement that says something about the function call. Your program will therefore print a log of events to the shell. Now you can try entering inputs and reading the log to see if your code is calling the right functions.

Milestone 3: Decide on your data structures

You will need some structures to represent all the profile information for every member, and you may want to represent more than that. Decide on what structures you will use. They should be able to represent all of the information in a way that makes them easy to use.

Milestone 4: Implement the commands for add, delete and go-to profile

Implement the functions for the commands add, delete and go-to profile (and any helper functions they need).

This milestone will require you to start writing code that involves the data structures you designed. The add operation will require you to create a new profile that has only a member name defined, and to make it part of whatever structure(s) you are using to hold the set of all member profiles. Delete will require you to remove a profile from your structures, as well as to update the friend list of anyone who has the deleted member recorded as a friend. Go-to profile will not require any updates to your major data structures, but there may be some variable(s) you need to update that keep track of who is the current member.

As you implement this milestone, think again about all the special cases that can arise with these operations (e.g., trying to delete a member who doesn't exist), and how you are handling them. You may want to make some revisions. This is also a good time to think about how well your data structure(s) are working for you, and consider whether any revisions would be appropriate.

This milestone will also require you to update your display. At this point, your code can only get a member's name -- status, photo, and friends updates are not yet implemented. So you may want to write only the code that updates the display of the current member's name, and postpone code for displaying the other elements of a profile until later.

Remember that each operation should update the system status display with information about what your program just did (or didn't) do. You might display, for instance, "Successfully added new member Nicholas Farnan" or "Please indicate whose profile to go to" or "There is no member Fred Flintstone; unable to delete."

Milestone 5: Implement the commands for change status, change picture, and add friend

Note that all of these operations apply to the current member, so be sure that your program always knows who the current member is. Also, if you haven't already, you need to decide exactly what your program should do if the user chooses one of these operations and there is no current profile, for example, when the program is first started (or a user was just deleted).

For the add friend operation, remember that friendship is reciprocal on facebooklet.

Milestone 6: Thoroughly test your program

Although you have been testing pieces of your program throughout its development, now you should verify that it works properly as a whole. For example, in an earlier milestone, you tested the go-to operation. But now that you have implemented the operations that update a member's profile, you need to confirm that go-to causes the correct member's status, photo, and friends list to be displayed.

This would also be a good time to re-read the entire handout and make sure that you have met all the project requirements.

Milestone 7: Implement and test your enhancements

By this time, you have had the experience of implementing the basic requirements and you can make a better estimate as to how much work your planned enhancements will be. Put this together with how many days you have left -- you may not quite be on your planned schedule -- and decide whether to revise your plans. Then go ahead and implement your enhancements.

Some final advice

If you develop your program in small, incremental steps, and you test your code as you go, then even if you run out of time at the end, you will still have a working program to hand in. It may not implement every feature, but what it does have will work, which will mean you can get partial credit for correctness.

Grading

To grade your assignment, the TA will run your program and test it. He will also examine your Python code.

To grade your enhancements, he will read enhancements.txt and run your application to test the features that are described. Only enhancements described in that file will be graded.

These are the aspects of your work that we will focus on in the grading:

What to Hand In

Hand in

Important: Make sure that we can run your project simply by running the code in facebooklet.py