EEE320 Lab 4

BugBattle version 0.3



The objectives of this laboratory are the introduction of the design pattern « Null Object », allowing you to practice solving simple design problems, and allow you to practice the creation of design documents in UML format using the ” VP-UML tool.



You must submit your la report and source code by e-mail to Abdalla Osman no later than the date and time specified on the course schedule. Please submit:

  • A .zip file containing your source code with comments, exported according to instructions in the Eclipse survival guide; and
  • A concise and well-formatted lab report, as a PDF file, which contains:
    • A brief introduction;
    • Your answers to the questions below;
    • The UML documentation as described below (i.e. one class diagram and two sequence diagrams enclosed in the PDF lab report and not in separate files); and
    • A brief discussion about what you learned, the discoveries you made, which was difficult in the laboratory. Be concise!


Required Tasks

Part 1 – Implementation and Documentation

Installation. Create a new Eclipse project and then download and import BugBattle version 0.2 into the project. Run BugBattle v0.2 to ensure it works.

Code familiarization. Generate javadoc documentation for the project in Eclipse. Choose Project > Generate Javadoc…, select the entire project in the “Select types…” field, and choose private visibility. Review the javadoc and the project source code until you are sure you understand it.

Change request familiarization. This lab is structured as a maintenance/enhancement activity, much as you would find in a real project. Carefully read the complete change request document for BugBattle v0.3.

Here’s what the finished product should look like, running:  BugBattle v0.3 Tool Demo [Created by Greg Phillips on Vimeo]

Implementation and documentation. Implement the change request, updating the javadoc as you go. We strongly encourage you to implement the changes in the order listed and to verify that each change is working before proceeding to the next. It is also a good idea to generate and look at the javadoc as you write it, to ensure that it is clear.

UML design documentation.

  1. Provide a single class diagram, similar to the one provided to you in the BugBattle v0.1 specification from lab 3. You do not need to show system-provided classes and interfaces in your class diagram. You may use the VP-UML “instant reverse” capability. You will need to reorganize the class diagram for clarity and add any important dependencies.
  2. Provide a sequence diagram showing how creature movement works using the Cilia organ, similar to the “Creature movement” diagram in the BugBattle v0.1 specification from lab 3. You do not need to show any looping or alternate cases; just document the normal case in which movement succeeds.
  3. Provide a sequence diagram showing how the sense() method of EnergySensor works. The same comments as for the first sequence diagram apply.


Part 2 – Questions

1. Javadoc. When generating javadoc documentation, you have the choice of what level of visibility to produce. In Part 1 you were asked to generate javadoc using private visibility.

a. Try generating javadoc with public visibility. What has changed?

b. Browse the Java™ Platform, Standard Edition 7 API Specification. provided by Oracle. What level of visibility is the Java SE 7 API? Explain why you might want to generate different versions of Javadoc, and for whom?

2. For loops. There are two different kinds of for loop syntax used in the World class. For example, in the method initialize()

for (int ix = 0; ix < WORLD_SIZE; ix++) {

… and in the method doTurn()

for (Creature c : creatures) {

Google-fu: this second kind is referred to as the “Java enhanced for loop” or the “Java for-each loop.”

a. Explain the difference between these two kinds of for loops.

b. Under what circumstances can each kind be used, or be prohibited from use?

3. Research the term “Round-trip Engineering” and explain what it means, in your own words. Do you believe that round-trip engineering support would be useful in the production of an evolving software product like BugBattle? Explain why or why not.

Scroll to Top