development

Development plan

1st Release: Isofunctionality

2nd Release: Improvements

Migration

This section aims to describe the migration of the Stellarium program from C++ to Java. The former has a lot of common with the latter, especially since Java 5. The issues are :

Instanciations

In C++, failed instanciations return null, which is usually interpreted by Stellarium as a sign for writing an error message and end the program. In Java, instanciations cannot return null. Either they succeed or fail, that is, throw an exception.

Typing

Booleans

Stellarium emulates boolean values though integer values. 0 stands for false, and 1 stands true.

Stellarium for Java uses the built-in boolean type, with the predefined constants false and true.

Operator redefinition

Stellarium uses C++ operator redefinition (which may be as useful as confusing).

Java does not support this language feature, but Stellarium for Java enable it through operator-like methods.

Enumerations

Stellarium uses C++ enumeration.

Java support this language feature since its version 1.5.

Generic types

Stellarium uses the C++ ability to defined parameterized classes, a.k.a templates.

This feature is available in Java since its version 1.5.

Method calls

Parameters by references

Stellarium uses "out" parameters that are modified by the method and so can be interpreted as multiple returned values.

Java also pass paramaters by reference, but primitive types (int, double, etc.) are passed by value and simple types wrappers (Integer, Double, etc.) are immutable. Stellarium for Java can emulate it by using references to mutable objects.

Default values

Stellarium uses C++ default values, which allow the developper to avoid providing some parameter values which will be assumed as default values specified it the method prototype.

This language feature is not supported in Java, but can be implemented as overloading methods enforcing such default values.

Error management

Stellarium notifies errors as reserved return codes (-1, etc.) or booleans (0 for false)

Stellarium for Java uses the Java exception mechanism to notify errors.

Function pointers

Stellarium use the ability of C to use function pointers.

Because of its insulation from memory-specific issues, Java doesn't allow such a capability. However, it can be emulated through object design pattern such as Strategies.

Librairies

Graphics

Stellarium uses OpenGL both as its 2D and 3D graphic API.

In the Java world, OpenGL is available both through proprietary (JOGL) and standard (Java3D) APIs. We choosed to use JOGL to ease the initial migration step, then to use Java3D in a second release.

GUI

Stellarium implement its own Graphical User Interface.

In Java most of these functions are built in the platform, thanks to the AWT and Swing.

Date/time

Stellarium implements its own date/time funtions.

In Java most of these functions are built in the platform, thanks to the java.util.Date and java.util.Calendar classes