Hide menu

TDDB84 Design Patterns

Course Laboratories


Laboration 1

Laboration 2

Laboration 3

Laboration 4

Laboration 5

Code skeletons for all labs



Webreg

You need to register in Webreg before September 4.

Deadline

The deadline for handing in laborations is set to October 19:th.

Tips

  • There are some ConcurrentModificationExceptions thrown around in Lab3. Among other things this causes the shadows to disappear if they are drawn before the body with the renderer. You can fix this by using a java.util.concurrent.locks.ReentrantLock in Snake.java. Simply do lock() when the body-list or bonus-list is used. E.g.
      Snake.lock.lock(); //Use a static lock in the Snake class
      Iterator i = body.iterator();
      while(i.hasNext()){
        do_something_with_i();
      }
      Snake.lock.unlock();
  • From experience we know that Laborations 2 and 4 are more difficult than the other ones. You may do the laborations in any order you like.
  • If you want to add your applet to a webpage the code would look something like this:
    <html>
    <body>
    <applet code=lab2Source.StableApplet width=400 height=400> </applet>
    </body>
    </html>
    The applet can be compiled with javac *.java. And your .html files with applets can be viewed with the appletviewer command in Unix.
  • If you use the command /student/bin/a2ps you get a good looking print-out that you can hand in to your assistant.
  • If you start an applet from Eclipse and the keyboard does not seem to work, try to add setVisible(true); right before requestFocus() in the applet init-code.

Page responsible: Peter Bunus
Last updated: 2012-08-31