15 October 2009

Should There Be A DB API For JavaFX?

I have identified a possible gaping hole when it comes to developing mobile JavaFX applications. Currently there is no DB API that can be used for accessing a database on a CLDC (mobile Java) mobile device. With the mobile part of JavaFX currently targeting mid to high range devices (mobile phones and smart phone) it would make sense to have a database on the devices. After all these devices would have enough resources to run a simple database (one with reduced features and capabilities, compared to its desktop version).

So it is time to start the debate on a DB API for JavaFX. Lets say hypothetically a DB API was to be designed for JavaFX. This DB API would have the following design considerations:

  • Provide a consistent API that can provide basic features across all hardware platforms (desktop, mobile, TV)
  • Allows advanced DB features to be accessed by desktop JavaFX applications only
  • Minimises its footprint and provides as many features as possible, without using too many resources on mobile devices
  • Allows seamless conversion between JavaFX Script and DB data types
  • Provides reasonably good performance (including on mobile devices)
  • Can easily allow syncronisation of data between the JavaFX application and the database in very few steps
  • Provides the cabability of querying the DB for internal information without requiring the JavaFX developer to describe the DB structure beforehand


Database API Advantages


  • Can use a database with a CLDC profile device (mobile JavaFX uses CLDC as the base)
  • Can easily use all JavaFX Script and JavaFX features (eg binding, triggers, functional programming)
  • Provides an opportunity for JavaFX to gain a major advantage over its RIA rivals
  • Can take advantage of Oracle's excellent DB design expertise (when the acquisition of Sun goes through)
  • A single DB API that can be used across all hardware platforms (desktop, mobile, TV)
  • Able to populate JavaFX controls (both visual and non visual) quickly and easily with very few steps
  • Seamless conversion between DB and JavaFX Script data types
  • Reasonably good performance with JavaFX having direct access to the DB


Database API Disadvantages

  • Will require JavaFX developers to learn a completely new API
  • Generics and reflection will not be available to incorporate into the design of the DB API
  • DB API will require existing DBs to supply new drivers
  • A new DB may need to be created from the ground up to work accross all hardware platforms (incl with CLDC profile devices)
  • May require existing DBs to adjust their design/implementation in order to be compatible with the DB API
  • Very challenging to design and implement an effective DB API (may take at least a year before it is ready for production use?)

Now the "should there be a DB API for JavaFX" could very well become one of the biggest JavaFX debates of the year. Currently the DB API for JavaFX should not be considered a high priority at the moment, since JavaFX is mainly aimed at creating graphical applications. Therefore stuff like 3D support is a much higher priority for inclusion in JavaFX.

I intend to make it very clear that I am not a member of the Sun JavaFX team. What I have mentioned above is my own opinions and in no way reflects the opinions of the Sun JavaFX team.

2 comments: