Search |
||
Piercing through data abstractionsPosted by johnreynolds on January 2, 2004 at 6:29 AM PST
Data Abstractions are wonderful things, except when they aren't.
A recent request from my QA team lead brought me to this not-so-stunning conclusion. The request was pretty simple: "Tell me which fields in our database correspond to the input fields on our HTML forms."This is a very reasonable request. My QA team wants to initialize our relational database with a specific data set, verify that the data displays properly in the browser, and then verify that changes made from the browser show up in the relational database.
A reasonable request, but also a rather ironic request: By practicing object oriented design principles such as separation of concerns and data hiding, we have crafted a system where the physical database structure is irrelevant to the web-tier of our application. Our web-tier components don't "require" a relational database� the data store could be an XML store or a comma-delimited-flat-file or a psychic channeling knowledge to and from an alien civilization. This is not an inappropriate or even an unusual abstraction, just standard design practice.
So how do I generate a mapping between specific fields on our HTML forms and specific fields in our database tables?
I think this is where Java metadata might come to the rescue (in the future). As I have indicated in my earlier blogs on Field Validation and on Java Process Definition, I am a big fan of metadata.
In this case, imagine that the metadata for my Entity EJB included the pertinent fact that a relational database is the data store. Expand that thought to include in the metadata the EJBQL select statement used to populate and update each field. Now add to my Fa�ade Session Bean an interface to pierces through the abstraction to gather details about the implementation� Not details that allow a consumer to take advantage of the implementation, simply details to document the implementation.
This mirrors Michael Champion's comments on contextual metadata: "We need to build tools and products that tap the small packets of structure and context and pull it into useful business information."The answers to many questions are there in the code, we just need better mechanisms for extracting them.
In the real world of today, I am going to sit down with a #2 pencil, some screen shots, our data model, and a cup of coffee. With any luck I will be able to provide the information that my QA lead needs by tomorrow morning.
(Cross posted at The Thoughtful Programmer) »
Related Topics >>
Community Comments
Comments are listed in date ascending order (oldest first)
|
||
|
|