|
XML MetaData for Simplifying Web Development
Achieve more efficient code development and maintenance while freeing yourself from object properties and getting new functionality without recompiling
by George M. Pieri and Arnoll Solano
August 2003 Issue
Web application development has become time consuming. Making a simple change to display a new database field on screen often involves recompiling business classes and then all the resources that use those business classes. You can simplify this Java development process by using XML to deliver your data and to describe the business objects that are responsible for building the data. Using metadata to describe your business objects and presentation components can speed up development. Metadata is data that describes data. An example of metadata that database developers currently use is the standard SQL Data Definition Language (DDL). DDL is used to describe the tables and field types of the columns that hold the real data.
Much of application development revolves around building business objects. These objects usually represent the entities of the system such as customers, invoices, and products. The responsibilities of a typical business object are to retrieve, add, update, delete, and validate data. The data usually comes from a data source, which can be a database such as Microsoft SQL Server or Oracle.
In the applications that we developed we use the term databean to describe the typical business object because its primary responsibilities revolve around data. In building business objects, or databeans, it is important to make them stateless to free you from the time-consuming process of maintaining properties. Stateless objects have no properties and instance variables that maintain state, which saves you time from having to add, get, and set methods every time an end user requests a new column to be displayed on one of your Web pages. All the data is returned each time a method is called. This characteristic also has the extra benefit of improving performance because the object can be reused quickly. It is possible to use XML to return the data without having business object properties. The start and end tags around the data field represent the field name, which frees you from having to maintain field names. In this sample the XML data is returned from a business object method that would have two properties, ContactName and Phone:
<Customers>
<ContactName> Maria Anders
</ContactName>
<Phone> 030-0074321 </Phone>
</Customers>
The properties are the field tags under the business object name tag called Customers.
Back to top
|