Here are presented notions of java, object oriented programming (OOP) and XML. The purpose is to permit the non-informatician reader to know what 'package', 'interface', 'abstract' ... mean.
Definitions are only given in JEphem context (some terms have a more general or deeper meaning).
Class : a class is a set of methods and fields.
Instanciating a class : if a class is not declared abstract, it can be instantiated through a constructor : an object is created.
Example : creation of an object of type Body
: Body b = new Body(MERCURY);
Each object can store its own data.
static methods or fields : when a class is instanciated, the methods or fields are bound to a particular instance of the class.
Static methods and fields are shared by all the instances of the class.
Abstract classes : Sometimes, classes don't need to be instanciated. For example, there is no interest in creating an instance of Pluto99
. So it is declared abstract
and contains only static methods.
In this usage, creating a class is just a way to organize the code.
Interface : they contain constants or declaration of methods without implementation. In JEphem, I used interfaces in two different ways :
- to store constants, like
jephem.astro.SolarSystemConstants
;
- to force certain classes to have certain characteristics
package : in java, the classes are grouped into packages. An API is generally organized into packages and sub-packages.
The fully qualified name of a class (which must be unique) is composed by its package name followed by its class name.
A widely adopted convention consists in naming packages only with lower cases.
Ex : class VSOP87.java
is jephem.astro.planets.vsop87.VSOP87
The file hierarchy must reflect the package hierarchy. See the page about source code for an example.
:
:
XML means eXtended Markup Language. It's a protocol to write documents understandable by humans AND machines.
For this, tags are employed. A tag is delimited by '<' and '>', and can have attributes.
Example : <myTag attribute1 = "attribute value">