Build Information
The project is developed using Eclipse IDE and .project and .classpath files are checked into SVN. Therefore compiling and running the project under Eclipse is straightforward.
The project is automatically built by Plectix's integration server each time any project file is committed to SVN. It is also deployed to the test server. Therefore, all developers must make sure the whole build process completes successfully before checking in their code. Note that the integration server runs "ant all" command, so compiling/running the project under Eclipse is not enough.
The integration server also automatically builds Javadocs so they are updated each time any project file is committed to SVN. Everyone in Plectix has access to them at https://integration.plectix.com/hudson/job/jsim/javadoc/index.html
Source Folders
The Java source folders are src/main and src/test.
The source folder src/main should be self-contained. In other words, no class under src/main should depend on a class under src/test.
The classes under src/test are test classes and their utility classes, which are not used by src/main.
The file and folder names should not include the following characters: " &\/`'!$^*()[]<>?" (the first one is white space).
Coding Guidelines
We must obey Naming conventions from Sun.
The file paths must be specified with caution. Plectix uses Mac OS X on its desktops and Linux OS on its servers (Windows is not the only OS in the world!). Java provides File.separatorChar character which should be used instead of '/' or '\'.
The variable, method, and class names must be long and verbose and not abbreviations (unless the abbreviations are universal). In the end, Eclipse auto-completes all names for us through Control+Space Bar. Nobody needs to type more than 3 letters per name!
Constants should be declared as "private static final..." at the top of a class and never inside methods. E.g. it is bad practice to hard code any specific paths. Paths are better declared as "private static final String" at the top of their respective classes.
Please use Enum for enumerated types and not arbitrary private static final int constants.
Catch blocks should never be left empty.
The project uses PlxLogger class for logging. Therefore, developers should refrain from writing to stdout or stderr, especially from classes under src/main. PlxLogger wraps log4j's org.apache.log4j.Logger class. The recommended usage is as follows: Define a static member at the top of your class, e.g. in the Simulator class we have:
private static final PlxLogger LOGGER = ThreadLocalData.getLogger(Simulator.class);
and then check the debug level before output call. For example, for debugging:
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Rule: " + rule.getName());
}
Logging is configured automatically in the main simulation. To configure it in a test class, use the static SimulationMain.initializeLogging() call.
New methods should be declared with the final modifier when implemented for the first time. This restriction can be easily lifted later if the method is overwritten in a subclass.