Tuesday, September 26, 2006

Interface APIs

Last night I started the Java 3D Interfaces (J3DI) API. J3DI is an "interface API". An interface API provides interfaces for the concrete and abstract classes of another API. The purpose is to be able to program your applications to the interface API so that you can swap out the underlying implementation at compile-time or run-time without additional coding. Applications and libraries programmed to manipulate instances of the interfaces will work with any of the implementations. Wrapper classes are used to adapt implementations to the interface API. They also shield application code from changes in the implementation APIs as they evolve over time.

J3DI is based on the Java 3D scene graph API. Sun Microsystems provides a public source reference implementation. Xith is an Open Source implementation of the Java 3D API with a few deviations. I developed a COLLADA loader for the Xith API. I also created a multiplayer game prototype and a 3D browser based on Xith. I am modifying the COLLADA loader, the game, and the browser to work with J3DI instead so that they can use either Java 3D or Xith as the underlying implementation.

Using J3DI also gives me the flexibility to experiment with a new implementation under development while retaining compatibility with working implementations. I am toying with a J3DI implementation (JIMP) that will render using another interface API, JIGL. No wrapper classes will be needed as the concrete classes will implement the J3DI interfaces directly. You can take a look at what I have so far in the project source code repository for J3DI, JIMP, and JIGL.


No comments: