Re: No knowledge of the database?
From: Daniel Parker (danielaparker_at_hotmail.com)
Date: 01/07/04
- Next message: Laurent Bossavit: "Re: Redundancy vs decoupling"
- Previous message: Ilja Preuss: "Re: TDD: Test-Driven Design or Test-Driven Development?"
- In reply to: Fredrik Bertilsson: "Re: No knowledge of the database?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 7 Jan 2004 09:18:29 -0800
fredrik_bertilsson@passagen.se (Fredrik Bertilsson) wrote in message news:<31f7e57d.0401062250.677aba3@posting.google.com>...
> > Your classes should be as independent of the database as possible.
> > Changing the table structure or database vendor should have little or no
> > impact on the client code or the external interface to your module.
> >
> Calum,
> can you give me an example of a table structure change you have done
> that have not changed the external interface of your database module?
> Your advise sound nice in theory, but it does not work in the real
> world. I have been doing like you say for some years, but in almost
> every case, a change in the database structure affects the code in the
> rest of the application, all the way to the client.
>
A select statement itself encapsulates the details of the individual
tables that data is coming from, and allows aliasing of column names.
The results come back to the client with a complete set of metadata
that describes the data types and column names. So, through the
select statements in views or stored procedures, you have the
flexibility of making significant changes to the physical table
structure - splitting one table into two, changing table column names,
etc. - without affecting client code. Assuming that your client code
has a binding layer that makes the appropriate type conversions to
client types, changes to database types such as varchar to date can
also be handled transparently, where they make sense. Similiar
statements apply to updates and inserts.
I've seen one project where we literally raised the app and replaced
one 150+ table database with a rather different one with minimal
initial changes to client code (more changes were later phased in.)
That was a while ago and the app was written in C against a Sybase
database, using stored procedures, and there was a signifcant amount
of infastructure to support the binding layers, including a data
dictionary and metadata support. This kind of thing is vastly simpler
with languages like Java and C# that support reflection.
Tools that support data binding from SQL result sets to the properties
of classes make a great deal of sense, provided that what's being
bound to are the results of queries. If tools would leave it at that,
they would be great. Where some of the OO data binding tools go wrong
is to do all this other stuff, for example, caching that makes no
sense (stand upTopLink), mandatory two part navigation strategies
(first get all the keys and then get the rows one by one), imposing
restrictions on table design (e.g. numeric id required.)
Regards,
Daniel Parker
- Next message: Laurent Bossavit: "Re: Redundancy vs decoupling"
- Previous message: Ilja Preuss: "Re: TDD: Test-Driven Design or Test-Driven Development?"
- In reply to: Fredrik Bertilsson: "Re: No knowledge of the database?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|