Hoppa till huvudinnehållet
Institutionen för informationsteknologi
  • How do I implement the exception classes? / I get complier errors like "can not resolve symbol IllegalPossitionException".
    • None of the exceptions used in the given interfaces are standard Java stuff, you need to add all the exception classes yourself. This is easy done by just creating a couple of java-files containing the line: public class BlahBlahException extends RuntimeException { } . We could of course provide these file, but it is actually faster to write them than downloading them.. ;)
  • About Observable: To make the simulation system observable, your general simulation class can inherit from the class Observable. This is a part of the Java standard library. Observable will give you a number of methods, for instance addObserver. When the simulation system changes, observers should be notified about it. If you use Observable, this is made in two steps. First, the simulation should set its own status to "changed" by using the method setChanged(). Then the system should notify all observers that changes are available by using the method notifyObservers(). The GUI implements the interface Observer required to work with Observable.
  • What should be presented in the design (UML)?
    • The easy answer is everything. There is a lot of things that should be in there and I will not even try to mention them all. It should be possible to understand how the application is built from the design. A few of the (many) key questions to ask is:
      • Who creates this object?
      • Who use this interface? (I'm not talking about implements here, that is obvious)
      • Who store the reference to this object?
    • Also remember to ask yourself:
      • What do these objects have in common, should i create a mutual superclass?
      • Do I have to check what kind of ojbect is running this code, should I split this class into specialized parts?
      • Will there ever be any object created out of this class?
  • Should inner classes be presented on a UML diagram?
    • Inner classes definitely have to be presented on the diagram. You can present it as normal class. There exist special notations to present inner classes but we do not require to use them. From the design point of view it is not important if you implement a class as inner or not. The important thing is that the class exists and it has methods, attributes, and relationships with other classes.
  • Why is there a constant defined in the interface Drawable (Assignment 1)?
    • This is wrong. I'm sorry! It should have been in AbstractFigure.java instead. If you have made any remarks or mentioned this constant in your UML, it will silently be ignored.
  • What is different between the assignment 2 of this year and the assignment from last year?
    • The major difference is that you don't need to implement the Graphical User Interface. Last year all default value settings had to be adjustable from the GUI, this is not in assignment 2 this year. Also minor changes of the given interfaces was done and your implementaion is a little more strict this year. The specification of the assignment was rewritten this year to make it more understandable. The design of the application for the last year's assignment is very similar to the design of the application for this year's assignment. But if your design was accepted last year we still require you to present your design and get it accepted again. NOTE! If you have done any implementation based on a design that is not accepted this year, you need to reimplement the system so that it follows your accepted design from this year.
  • If you have a superclass defining a method, and a subclass overriding this method, should the subclass present the method on the UML or is it only the superclass?
    • Yes, the subclass should also present the method on the UML. It helps to see that the subclass overrides this method.
  • Should we present standard classes, e.g. JPanel, on the UML diagram for the assignment 1?
    • You should present all standard classes that are explicitly mentioned in the source code of the assignment. E.g., the class Board extends JPanel, this means that JPanel should also be on the diagram. You don't need to present methods and attributes of the standard classes. You don't need to present implicit inheretance from the class Object.
  • Should we present cardinality for associations between classes on UML diagrams?
    • Yes, you should.
  • How do I set the CLASSPATH?
    • The clas-path can be set using an UNIX environment variable or given to the compiler and runtime system via a flag. The syntax for the flag is: java -classpath [some_directory] and to set an environment variable in bash you type: export CLASSPATH=some_directory.
    • The class-path can contain several directories, they are separated by colons (:).
    • To make Java find classes in your current working directory add "." to your class-path.
    • To use packages add the path to the parent directory of the package, e.g. To use the package ~user1234/java/simsys add ~user1234/java to your class-path.
    • To use jar-files the complete path including the file name must be in the class-path.

Uppdaterad  2004-12-08 20:01:08 av Jesper Wilhelmsson.