Jump to content
Ian Branch

One place to rule them all???

Recommended Posts

Hi Team,

Philosophical discussion.  Bit like which word processor is best.

Is it better to have all the Database related components TEngine, TSession, TConnection, TTables, TQuerys, etc, in a datamodule or scattered around the forms..

Pros & Cons - Ready... Go!!

Share this post


Link to post

We create all these in code.  No visual components used.

We have no sea of DB components floating in designers. It requires a bit more scaffolding code, but it can be generalized and made threadsafe.

  • Like 8

Share this post


Link to post
1 hour ago, Ian Branch said:

Hi Team,

Philosophical discussion.  Bit like which word processor is best.

Is it better to have all the Database related components TEngine, TSession, TConnection, TTables, TQuerys, etc, in a datamodule or scattered around the forms..

Pros & Cons - Ready... Go!!

Hi Ian,

 

on our mainapp we have one tDataModule with tEngine, tSession but we create all other tTables and tQuery etc. in runtime on each form.

This is different when we have threads: for each thread, we create a seperate tSession

Share this post


Link to post
1 hour ago, Lars Fosdal said:

We create all these in code.  No visual components used.

We have no sea of DB components floating in designers. It requires a bit more scaffolding code, but it can be generalized and made threadsafe.

Yes, rapid development is not always the best solution for big projects.

Share this post


Link to post

In small demo applications, I use a TDataModule with component dropped on it.

For real world large application, I use a simple unit have the code that encapsulate database access and database components are created at runtime. The unit offers classes that give access to the data stored in the database in an abstracted way. More code but much better program if correctly designed.

  • Like 2

Share this post


Link to post

In our 24+ year old system we have a central TDataModule with the connection and shared data access for things used everywhere like customer information retrieval.  Then each form has form specific queries/datasets/command and datasource components dropped on them (no tables) for the form related data.  We don't have a sea of DB components on most forms, but if I could go back 25 years knowing what I know now, I would do it all through objects and/or use some type of ORM and have no DB components anywhere.  Now, where is my Tardis?

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×