11. Deciding between Defined versus Derived Data Models

PROBLEM

There are two ways implement a data model using Skyway Builder: natively and externally. While the result is generally the same, there are some definite pros and cons to each approach. Based on the application requirements, a developer needs some guidance on deciding the best approach.

SOLUTION

The following table summarizes the differences between externally defined data models and natively defined data models.

Table 4.4. Comparison of Native and External Data Models

Native ApproachExternal Approach
Defined in an object-oriented manner; the patterns for storing object-oriented data in relational databases are very well defined and handled by the ORM framework and JPA provider.Defined in a relational manner with object-oriented facade; relational schemas don't translate perfectly to objects.
Data model created in same application development environmentData model must be defined using separate tools; all developers will need access to DBMS client tools
Data model changes are immediately available in the Skyway projectData model must be rediscovered before being available to Skyway project
Data model can easily evolve during application development; the initial definition of the data model can be pretty looseAll data model changes must be done externally; extra effort required to import data model; therefore you will probably want data model to be well defined before commencing with development
Data model changes are version controlled with the other application development artifacts; easier to identify correct data model implementation for earlier versions of applicationIf data model changes are version controlled at all, it will be done separately from project
DBMS expertise not neededDBMS expertise needed; DBA may need to get involved too
Data model can be deployed to any supported DBMS for maximum deployment flexibilityThe data model is tied to the DBMS that it was derived from
Sharing project is simply a matter of copying project folderSharing project requires copying the project folder and providing the ddl for the database

While native data models offer maximum flexibility, there are occasions where external data models are the only or most suitable option. Here are some comman scenarios where you would use external data models:

Table 4.5. Scenarios for using external data models

ScenarioDescription
Application MigrationNew front-end to existing application database
IntegrationIntegration with external systems
Applicatoon Interface tablesTo facilitate external applications integrating with Skyway application at DB level
DB Centric DevelopmentYou are philosophically opposed to starting development until the database schema has been defined