INFORMIX
DataBlade Developers Kit User's Guide
Chapter 2: Designing DataBlade Modules
Home Contents Index Master Index New Book

Data Model

A data model is a high-level definition of a DataBlade module: what objects it will represent and what operations on those objects it will provide. Here are some issues to keep in mind when you design a data model:

For example, consider the fictitious SimpleMap DataBlade module, which stores, manipulates, and displays maps. The data model for this DataBlade module might specify:

This data model allows you to make requests such as, "Find all the polygons in the map that fall inside the currently visible region, where the currently visible region is a given polygon." The query scans the database and returns only the polygons that meet the request criteria.

However, the display logic for the data types does not belong in this data model; the rendering of polygons is a user-interface issue. After the desired polygons have been retrieved from the database, the client application displays them.

The data model for a DataBlade module must be simple to understand, and the DataBlade module must provide a rich set of services using a minimal set of routines. This fundamental software design concept applies to DataBlade modules in particular, because DataBlade modules are intended for use by other developers.

For example, in the SimpleMap DataBlade module, assume that users want to find overlapping regions on a map. The DataBlade module can provide a number of different interfaces to support the query. Two examples are:

and

The Overlaps() routine returns TRUE if any parts of the two polygons overlap, while the Contains() routine returns TRUE if the first polygon completely contains the second. These two routines are simple to understand and easy to remember.

However, if the semantics of two routines are too similar, users may have difficulty remembering which routine computes which value. For example, say the SimpleMap DataBlade module also provides the following Intersects() routine:

This routine returns TRUE if the boundaries of the two polygons intersect. Intersects(a, b) is equivalent to the following:

Intersects() and Overlaps() are confusing when both are supplied. Because Overlaps() and Contains() together can compute intersections, it is probably best to leave Intersects() undefined.

When you design a data model, separate the routines used by a single application from the more general service routines. For example, perhaps you want to provide a routine that takes a polygon as an argument and returns another polygon with a border exactly one pixel outside the original. To display the new polygon, the two polygons are used together to create the appearance of a polygon with a thick border.

Such a routine is probably useful only for a particular application that displays thick-bordered polygons; it is not useful to other applications that operate on spatial data. Thus, it is a poor candidate for inclusion in a DataBlade module.

In summary, these are the issues to consider when you design the data model for a DataBlade module:




DataBlade Developers Kit User's Guide, version 3.6
Copyright © 1998, Informix Software, Inc. All rights reserved.