CM10135 / Programming II:   Assignment 2 (2007)

Build Your Own Chat Application

Assignment Date:  Friday,  2 March.  

Due dates:     First Increment:     Monday,  12 March at 4:00pm

                      Final:                     Friday,    23 March at 4:00pm

                      Late Final (only 10% off):             Tuesday,    17 April at 12:00pm

This assignment is the second of three you will have in this course.  Your mark in Programming II is composed of 40% coursework, 60% exam.  This coursework is worth 17%. 

NB:  This coursework must run in the version of Java which is on the BUCS unix servers!  Be sure to test your program there before handing it in.

Special marking category:     
Students who feel they need extra time may work on this assignment over break for only a 10% penalty.  However, they will not get extra support, so we strongly advise finishing the assignment before break.  After noon on 17 April the ordinary late penalty will apply.

The Basic Idea & Objectives:

In this assignment you will be creating a GUI application that allows people to chat with each other.  This project should let you develop and display your skills in GUIs,  networking and handling exceptions, and maybe threading if you are ambitious.

As has been covered in class, a lot of building GUIs, getting networking working, and generally writing code in industrial situations comes down to finding appropriate examples of the functionality you want in documentation, and then adapting them to your own needs.  This coursework is designed encourage you to learn how to put a big application together using design patterns, java doc and the Sun java pages.

This assignment is expected to take the average student (one who got about 58 in Programming I) about 30 hours.   As mentioned in class, this is a double unit, so it is expected you spend about 20 hours a week on the course, including lectures, lecture preparation, labs and self study.  The reason the coursework is scheduled over 3 weeks is because of the diversity of material in it, so you can have lots of chances to talk to the TAs in lab.  The reason there is an incremental hand in is to make certain you do in fact get started on it in good time.   

Please note though that programming takes different people radically different amounts of time, so some students will need to spend considerably more or less than 30 hours on this assignment.

Reminder on plagiarism:  Plagiarism occurs any time that you use someone else's ideas without acknowledging them.  Plagiarism is much, much worse than asking for help.  If you get help on any part of your assignment you should acknowledge this in the comments.  This includes asking coursemates, tutors, or other staff, as well as reading things in books, java documentation or elsewhere on the Internet.  Particularly for this coursework, you may be starting with code you copy from the lecture web pages.  Wherever you get help from, you should acknowledge it immediately in the comments as well as in the documentation.  Say exactly where your help came from, and exactly how much of the code is your own.

What to do:

There are many possible things to do on a chat application, and I do actually want you to have fun with this.   But the most important thing is to get the networking going first, so we're making an incremental hand in to make sure it does.  

Important note:  Do not wait until your incremental assignment is marked to start on the main assignment!  You shjould start working on your GUI immediately, and you should read this entire assignment before working on the networking portion.  The only reason there is an incremental assignment is to simplify the marking & make sure everyone gets their chat programs actually chatting.

First Increment: Basic Networking

Note:  this is very much like the code that was already given to you in lecture.  It should not take you more than a few hours to get it working.  You should start your GUI programming in the first week as well as finishing this increment.
  1. Make two command line applications, a server and a client.
  2. These should take a command line argument of  a port number.  The client also needs an argument for the IP address.
  3. Make your application work across a network, e.g. use it to have a chat between two BUCS computers.  Make sure it will also work in two windows on one computer as well though --- that's how it will probably be tested.
  4. Be sure to do good exception handling, e.g. so you can tell if the client couldn't find the server.
  5. Once the applications are both running & connected to each other, make sure you can type text into one of the applications and it will print out in the other

What to hand in (incremental)

  1. Your well-formated, fully commented code.
  2. That's it! 
  3. Submit it through moodle.  

How the incremental assignment will be marked:

  1. Marking will happen in lab during your next lab after the 12th March.
  2. You must attend your lab session or you will lose points.
    1. People who have Monday labs will be marked on the Wednesday lab on 14 March to make sure they get their code working on time!  We will have an extra tutor available to handle the extra number of people.
  3. You will get to witness the marking process, so you can see why we ask for well formated code!
  4. If your code doesn't work, hopefully the TAs will be able help you so this doesn't cause problems with your main project.

Specific Criteria Marks
Out Of


Commenting  -- clarity of code


Commenting -- acknowledgments


Connection works


Typing between applications works


Student Present
present & helpful when marking


e.g. doesn't compile,
difficult to test





Main Assignment

Important note:  Do not wait until your incremental assignment is marked to start on the main assignment!  You can start working on your GUI immediately.  The only reason there is an incremental assignment is to simplify the marking & make sure everyone gets their chat programs actually chatting.

Everyone should pick 100 points worth of ideas from the below list.  If you do more than 100 points worth, you won't get any extra credit for this!  I don't want you to spend too much time on just this coursework.

All point values below are maximum.  To get full points, you must write clear code with good comments, good exception handling, good testing and write good documentation as specified below.
  1. Remember to write an informal specification / requirements statement of your application before you start.  You will probably want to draw the window(s) you want to build, and specify some classes.
  2. First, you want to build a GUI application with some labels, two large text panes and at least one button.
    1. One text pane is for typing into / sending messages, the other is for receiving messages.
    2. The labels should make it clear which is which.
    3. One button should let you quit the application.  You might want to add other buttons too (see below.)
    4. This part is mandatory, and is worth 30 points.  You should try to get it done in one week.
  3. The networking is also mandatory, and worth 30 points.
    1. 20 points are from the incremental assignment, above; 10 are for making this work in the GUI.
    2. Make certain that your GUI has panes for entering the port into both the client & the server, and the IP address into the client.
    3. You probably want your server to have a pane showing its IP address, that will make it easier to use.
  4. Now choose 40 more points from the list below.
Remember: functionality alone doesn't get you high marks!  There should be good code layout, good comments, good documentation, good testing and good exception handling. 

When you are filling in the Feature Table as part of your specification (see right below) remember that you can also get some marks for things even if you haven't got them working in time for the hand in.  This is particularly true in the specification and analysis sections.  So be optimistic in your initial specification.  Have fun!

What to hand in:

  1. Your informal description of your classes & algorithms.
  2. Your fully-commented code. 
  3. A short (2 to 4 pages) write-up documenting your program.
    1. Include a screenshot of your GUI.
    2. Be sure anyone (try your non-CS friends, or family if they are online!) could run your program from this documentation.
    3. Some critical analysis of your program: 
      1. What did you do right?  What did you do wrong? 
      2. What would you do differently if you did it over?
      3. Be sure to draw attention to any work that you think was particularly clever or difficult -- we are checking a lot of projects!
  4. Zip (or tar) everything, including uncompiled versions of your code, and post it on Moodle. The person marking your program will be compiling & running your program.
  5. Please also put a printed out copy of your code & documents in the box by the department office.  If you do this, we will give you more feedback.  But you must still submit moodle, that is your real submission.
Remember: marks are not given just because a program compiles or runs!  It should run robustly, and it should be well commented, tested &  documented as specified above.

How you will be marked:

NB:  This coursework must run on the Java on the BUCS unix servers, which is not necessarily the most recent one.  Check this before you submit!

The marks allocation for this assignment is as follows:
  1. Informal Specification 10% 
  2. Fully commented, working program implementing your design 70% 
  3. Documentation and Analysis 20% 
Total 100%

Threshold for Pass (40%+)
  1. Brief discussion of requirements and design. 
  2. Simple program. Basic level of commenting. Code layout is mostly correct. Minimal exception handling necessary for a compile.
  3. Minimal functionality: 
  4. Minimal documentation so that the system can be run without making the marker hack it. 
Good Pass (~55%)
  1. Specification covers all aspects of the problem at an appropriate level of detail. Good program design and plan for implementation.
  2. Program is a good implementation of design, or possibly better than the design. Code is concise and comprehensible.  Layout of code is correct and clear.  Some reasonable exception handling, e.g. reasonable messages or steps taken on likely exceptions.
  3. GUI appearance uncluttered and clear.
  4. Basic functionality: 
  5. Documentation clear, concise and helpful. Sensible criticism of your work, and good ideas for improvement. 
Distinction Pass
  1. Specification covers all aspects of problem.  Design description starts with a high level design and showing refinement to appropriate levels. Algorithms and implementation plan are given at an appropriate level of detail and are well explained.
  2. A sophisticated program showing good use of Java, but not overly complex. Commenting is appropriate and gives sufficient information, but is not overly verbose. Layout of code is correct and clear. Fully appropriate use of exception handling.
  3. GUI attractive, functionality / usability is apparent without much documentation.
  4. All or nearly all 40 points of chosen functionality works well.
  5. Documentation clear, concise, attractive and informative. Detailed and thoughtful criticism of your work, and well-thought-out ideas for improvement, possibly including descriptions of alternative implementations.

Marks Table:

Specific Criteria Marks
Out Of
Informal Specification




Commenting  -- clarity of code


Commenting -- acknowledgments



[Networking -- from incremental hand in]


[Networking in GUI]


[And the rest]


Total from Feature Table / 2


Results & Analysis Documentation / Instructions


Analysis & Suggested improvements


e.g. doesn't compile,
difficult to test




page author: Joanna Bryson
assigned 2 March 2007 (checked by AMB), added note on hardcopy 13 March.