JBoss.orgCommunity Documentation

Chapter 17. Development

17.1. Methodology Overview
17.2. Development guidelines

The diagram below explains the overall structure of the OptaPlanner source code:

The development philosophy includes:

  1. Fail fast. There are several levels of fail fast, from better to worse:

  2. Exception messages

    1. The Exception message must include the name and state of each relevant variable. For example:

      if (fooSize < 0) {
          throw new IllegalArgumentException("The fooSize (" + fooSize + ") of bar (" + this + ") must be positive.");
      }

      Notice that the output clearly explains what's wrong:

      Exception in thread "main" java.lang.IllegalArgumentException: The fooSize (-5) must be positive.
          at ...
    2. Whenever possible, the Exception message must include context.

    3. Whenever the fix is not obvious, the Exception message must include advice.

      Exception in thread "main" java.lang.IllegalArgumentException: UndoMove corruption: ...
        1) Check your custom createUndoMove() of ...
        2) Check your custom Variable listeners if ...
          at ...