Principle: Interface-based Design
In the InfoGrid codebase, major concepts are all defined as Java interfaces. InfoGrid then also contains one or more implementations of those interfaces to make them concrete and usable by application developers.
This enables developers:
- to develop applications that need to change less frequently in response to changes in InfoGrid
- replace InfoGrid-provided implementations of certain concepts with their own implementations.
Often, the following pattern exists:
- interface XXX - the concept
- abstract class AbstractXXX - factors out functionality common to many implementations of XXX
- several concrete implementation classes such as public class AbcXXX and public class DefXXX.
For example, interface MeshBase introduces the concepts of a MeshBase. abstract class AbstractMeshBase collects functionality that is likely useful for many implementations of MeshBase. MMeshBase implements MeshBase in an in-memory only implementation, while StoreMeshBase implements MeshBase delegating to the Store abstraction.
Similarly, StoreMeshBase only dependes on public interface Store, not on any particular implementation of Store. This enables developers to store MeshObjects in any Store, such as one based on a relational database or on grid storage, or any other implementation by any developer, without requiring changes to their application.