Gilles Ganault wrote:
>
>> We haven't used TDataSource in quite some time and actually don't miss it.  
>>     
>
> I didn't know you could do away with all those components to connect
> DB-aware widgets. If you have some DelphiWin32 "hello, world" sort of
> code, I'm very interested :-)
>   

You can't.  You lose the db aware aspect, but what I'm saying is it 
isn't as "bad" as I used to think.

>   
>> Although for years I was concerned about the cost in programmer time of 
>> using disconnected components, I've found the gains from using 
>> TDataSource are outweighed by the non-deterministic behavior of the data 
>> connections.
>>     
>
> Care to be more specific? In short, what are the drawbacks about using
> Table/Query + DataSource?
>   


The primary source of non-determinism is that the user tends to get 
involved.  Most code is triggered by events, which works up to a point.  
Once the model breaks down, it does so in a way which cannot be easily 
worked around.  I can recall many times having to stick convoluted logic 
to handle the case of one field being updated which causes other data to 
be affected.  By going to a non data-aware model, all those issues 
disappear because your posting logic becomes 100% deterministic.  There 
are no side effects due to events firing off.

As a generic example, if you attach something like a grid to a table, 
you must either maintain an open connection to the table or transfer the 
data into a memory table.  Keeping a live connection is potentially 
dangerous and memory consumptive.  Using a memory table is useful in 
small circumstances, but once you reach a certain amount of rows, you 
end up writing caching code to maintain performance.

For this example, the solution I've found which works is to have a 
non-data aware grid in virtual mode.  The system uses a data supply 
model which figures out what is to be displayed and supplies it to the 
grid on demand.  It's scary at first, because you feel like you are 
re-inventing the wheel, but you quickly find out you are not.  
TDataSource/TDataLink was a good idea in its time, but it is way out of 
date and, in my experience, creates as many problems as it solves once 
you start building more complex user-centric GUIs.

FWIW

John Elrick
Fenestra Technologies
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to