UCL Logo

1008 Object-Oriented Programming

Mini-Project 2006


Deadline: The printed version of your work must be handed in to the departmental office by noon Thursday 23rd March. In addition, a version should be submitted electronically using the handin program (details will be emailed closer to the deadline). A readme file should be included explaining how to compile and use your program, along with any other documentation needed.

With the printed version of your program you must submit an UML class diagram, documenting the classes and their relationships within your program. A hand drawn diagram is entirely acceptable.

Aim: The aim of this mini-project is to write the best and most interesting program you feel able to, putting into practice all that you have learnt so far. Time is limited and there will be courseworks to complete for other courses, so as always plan carefully and make the best use of your time.

Marking: The work will be graded A-F.
On this scheme a grade C is considered to be basically satisfactory which means the program runs, does more or less the right things and has a reasonable object-oriented design. Grades B and A represent better and excellent programs, while D and E are progressively less good programs that show serious problems in execution and/or design. Grade F means a failure to present anything of merit.

Plagiarism: The electronically submitted version of your program will be run through an automated plagiarism detector. This is very reliable. Don't cheat.

If you use code that you have not designed or written yourself, you must clearly state what the code is, who wrote it and where it came from. Put those details in your readme file and also add comments in the source code to show where the code came from.

There is nothing wrong in talking to other people about the design and implementation of your program (but don't expect the other person to do all the intellectual work). However, if you find you are sharing ideas, or even similar sections of code, make that clear in the readme file and source code comments. Don't simply include copied sections of code in the hope they won't be noticed - they will as they are really obvious to the trained eye and plagiarism detectors.

Getting a good grade: (This advice is similar to that for the 1007 mini-project, but it is still good advice!)

All projects require you to write an object-oriented program, making full use of classes, objects and all their associated features. Marking will take into account the quality of the program you write. In particular pay attention to the following:

  • Proper declaration and use of classes.
  • Proper use of objects.
  • The layout and presentation of the program code.
  • Appropriate selection of variable and method names.
  • Good use of comments to make sure that your code is properly documented.
  • Selection of a suitable design to provide an effective solution to the problem in question.

A clean straightforward working program, making good use of classes and objects, is considered better than a larger and more complex but less well-organised program.

Development Advice:

  • Keep things simple but sufficient to to the job properly.
  • Keep things simple! (Very important so I've repeated it.)
  • First brainstorm/doodle/sketch to get a feel for the program you need to write and start identifying classes and objects. Typically potential classes can be found by looking for the nouns in the program description.
  • Don't rush into writing Java code if you don't fully understand what classes, objects and methods are needed. Don't let the detail of writing code confuse your design thinking.
  • Think carefully about objects ? what data/state should an object hold, what methods does it need? Use this information to fill out the object's class. Only add instance variables and methods once you see they are really needed.
  • How is the behaviour of the program implemented in terms of method calls on objects? Do the objects have the right methods and references to one another?
  • Role play or talk through the sequence of method calls between objects to make sure everything makes sense.
  • Are your methods short and cohesive? Are your classes cohesive?
  • Can't get started? Do a subset of the problem or invent a simpler version, and work on that to see how it goes. Then return to the more complex problem.
  • Remember - instance variables should always be declared private.

Tools

As you start working with classes and larger programs you are encouraged to use the BlueJ tool. This is designed for use by people learning to write object-oriented Java programs and is very straightforward to use. BlueJ can be run on a lab machine by typing the command bluej. BlueJ is also included on the programming CD for installation on your own computer.

More information about BlueJ and the user manual can be found at: http://www.bluej.org/.

If you want to try a more advanced programming environment then look at Eclipse, the widely used open source tool. Eclipse is installed on lab machines or can be downloaded from www.eclipse.org. Note that Eclipse is a professional level tool so does take a bit of time to learn and get used to - it may well not be appropriate for your current level of experience.


Getting Started

First carefully read the code and notes for the Snack Bar program example available from the 1008 web page (and have another look at the COMP1007 phone list program as well). See http://www.cs.ucl.ac.uk/staff/G.Roberts/courses2005_6/1008/snackbar/snackbar.html. Make sure you understand the development process that is proposed, so you can apply it in your mini-project. Also make sure you have read chapter 10 in the course text (in addition look through Part III).

When ready to start, select one mini-project idea from the list below (they are not listed in order of difficulty although some are more challenging than others). Remember that you are writing an object-oriented program and should be using at least half a dozen classes. The ideas are deliberately open-ended, so you will have to fill in the details and determine exactly what your program should do. It is up to you to take the mini-project as far as you can. If you cannot get started or the questions seem too complex then simplify the requirements and try a more basic version of the question. Remember the strategy of starting simply and then adding features step-by-step.

Make sure you attend your programming lab class to get advice, help and feedback. Getting feedback is important to make sure that you are not going in the wrong direction, so please don't ignore the labs.


The Mini-Projects (Select One)

Q1. Write a program that can act as an interactive dictionary with the following functionality: The meaning of a word can be looked up. For example, entering the word “hello” will display the meaning “a greeting”. New words and their meanings can be added. Words and meanings can be deleted. The entire collection of words and meanings can be saved to a file and read back again next time the program is run.

Q2. Write a program to organise lab and problem class groups. It should be possible to specify class times, input a list of preferences for each student (using preferences like those you gave for COMP1007/8 classes), and publish a list of groups. Each group has a maximum size, so not everyone can expect to get their first (or second, third, etc.) preference. Every student should be allocated to classes.

Q3. Write a program to provide simple inventory system for a bookshop. It should hold the current list of stock, allow updates, additions, deletions and so on, and keep records of all books sold. It should be possible to display stock and sales reports.

Q4. Write a program to index and search text files. It should be possible to index any number of text files, creating a shared index for all the files, with common words like “a”, “and”, “the” excluded. An index entry should include the source file, line and start position of the word being indexed. It should be possible to search the index for a given word and be given a list of where the word occurs in which files, then select a list entry and display the surrounding lines of text from the original file. It should also be possible to search for multiple words using AND and OR to generate the search pattern. It must be possible to load and save the main index between each session of running the program.

Q5. Write a program that can read one or more .java files (Java source code), extract information about each class (variables, methods, etc.) and do two things with the information: i) create a report summarising each class, and ii) draw a UML class diagram representing the classes and relationships found.

Q6. Implement a simple Prolog interpreter in Java.

Remember, when you submit your project you should include an UML class diagram documenting the classes and their relationships.

Last updated: September 2, 2006

Computer Science Department - University College London - Gower Street - London - WC1E 6BT - Telephone: +44 (0)20 7679 7214 - Copyright 1999-2006 UCL


 Search by Google