?
Solved

Delphi 2007 what use is there for a datamodule

Posted on 2009-12-19
3
Medium Priority
?
519 Views
Last Modified: 2013-11-23
My applications starts to become swamped with non visual components, most of them for database access so i looked into the TDataModule form. Great i thought - now i can get some structure. Only problem is there seams to be no way i can group them. I want to also have some comments to what each Query does, or what a group of query does. Am i missing something or should i use a regular form for this?
0
Comment
Question by:Paer Toernell
3 Comments
 
LVL 11

Assisted Solution

by:Goodangel Matope
Goodangel Matope earned 400 total points
ID: 26089757
Well, fortunately it is not compulsory to structure things a certain way when dealing with non visual components.

A Datamodule is a great way to create a semblance of order, especially when you consider that it is possible to have more than one data module per application. You can therefore create a data module for each of the "groups" of queries you are talking about, for instance, create a datamodule called dmFrontOffice for queries used by the front office module of your application, and dmBackOffice for those queries that are used by your back office module. This way, you will be able to group the queries as you see fit, and have some "structure" going.

Datamodules can also be used to contain functions and procedures which are non-visual, and are used throughout the application, and hence should be in a "central" place and not on individual forms.

I have seen pretty interesting application structures in my time, but I have noticed that each developer usually has a reason for doing things a certain way. I guess what you will need to do is come up with a structure that works for you.
0
 
LVL 31

Accepted Solution

by:
moorhouselondon earned 600 total points
ID: 26089838
What I did do for a while when originally getting to grips with separating engine from user interface was to use a regular form and treat it like a Datamodule, but to not show it to the end user.  

Advantage of this method is that you can put informative comments against each non-visual component on there as a means to document what it does, rather than putting such comments into the underlying code.  Also if you want to diagnose code within this module and want to use quick n dirty techniques such as showmessage, a diagnostic dbgrid, or put test queries into a memo on that form then there's nothing to stop you, whereas datamodule won't like that.  

As goodangel says, you can have as many datamodules as you want in an app, and that is the intended usage.
0
 

Author Closing Comment

by:Paer Toernell
ID: 31668205
Yep, think i got it. I go with moorehouse concept. Thanx
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Containers like Docker and Rocket are getting more popular every day. In my conversations with customers, they consistently ask what containers are and how they can use them in their environment. If you’re as curious as most people, read on. . .
In this blog, we’ll look at how improvements to Percona XtraDB Cluster improved IST performance.
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question