BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

TDataModule as Persistence Manager

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi OO design
View previous topic :: View next topic  
Author Message
Mark Reichert
Guest





PostPosted: Thu Jan 18, 2007 3:36 am    Post subject: TDataModule as Persistence Manager Reply with quote



From http://bdn1.borland.com/article/borcon/files/9022/paper/9022.html

Isolating these layers and decoupling their interaction then results in a
programming architecture that looks like

GUI
\
Presentation Manager/Abstraction Layer
/
Object Layer (problem domain code)
\
Persistence Manager/Abstraction Layer
/
Database

As I mentioned in the "Data Access Layer and Data Modules" thread, I was
already wanted to make it GUI-Business Class-Data Module-Database. I'll
have to give more thought to how the Business Class would be seperated into
a Presentation Manager and Object Layer, if they even need to be.

Making a TDataModule act solely as the Persistence Manager might help with
the downside mentioned here:

*****
Dataset/Datamodule based approach. Base your business object on a class that
Delphi already provides for you for handling persistence issues, the
TDataModule. The program on the front end uses the business object exposed
by the datamodule but does not ever access the persistence internals
directly. Alternatively, derive a custom TDataSet descendent that
understands its own rows as representing the properties of a specific object
class.

Upside: this is a cake-and-eat-it-too approach if you're a fan of data-aware
controls, because if you do it right you can expose business object
properties to DA controls in your front end as TFields.

Downside: Descending from a data module or data-oriented object means that
while you may provide OO methods and properties, you can't really achieve OO
containment-it may be too easy and too tempting to bypass the object
structure.
******

I'm not really interested in the Upside mentioned since I'm not using DA
controls. I am interested in using the standard methods with interacting
with databases provided by Delphi 2005, and a TDataModule makes a nice
standard container for the IBSQLs and IBDataSets I'm using.
Back to top
Mark Reichert
Guest





PostPosted: Thu Jan 18, 2007 11:48 pm    Post subject: Re: TDataModule as Persistence Manager Reply with quote



"Mark Reichert" <mark (AT) messagelink (DOT) com> wrote in message
news:45ae9614$1 (AT) newsgroups (DOT) borland.com...
Quote:
From http://bdn1.borland.com/article/borcon/files/9022/paper/9022.html


I found this post from Mr. Niddery five years ago as well:

http://groups.google.com/group/borland.public.delphi.oodesign/msg/4449022e204b5f6e?hl=en&

The state of the art has undoubtably moved on from then, but I'm having a
hard time finding the proper documentation.
Back to top
Bart
Guest





PostPosted: Fri Jan 19, 2007 12:33 am    Post subject: Re: TDataModule as Persistence Manager Reply with quote



Quote:

The state of the art has undoubtably moved on from then, but I'm having a
hard time finding the proper documentation.

I also had a hard time to find proper documentation. Especially in Delphi.
But a few days ago I found something in C#. It is called CSLA. It is open
source and the author wrote a good book about it.

http://www.lhotka.net/cslanet/


if you search the net you find a lot of resources about this framework.

Maybe it is usefull for you to study.

Regards,

Bart
Back to top
Bob Dawson
Guest





PostPosted: Fri Jan 19, 2007 12:45 am    Post subject: Re: TDataModule as Persistence Manager Reply with quote

"Bart" wrote
Quote:
But a few days ago I found something in C#. It is called CSLA. It is open
source and the author wrote a good book about it.

CSLA is not a persistence framework--it's an object remoting framework. Very
different.

bobD
Back to top
Bart
Guest





PostPosted: Fri Jan 19, 2007 12:54 am    Post subject: Re: TDataModule as Persistence Manager Reply with quote

Quote:

CSLA is not a persistence framework--it's an object remoting framework.
Very
different.

So I do understand this wrong ?:


"CSLA .NET is designed to allow great flexibility in object persistence, so
business objects can use virtually any data sources available. The framework
is designed to enable single tier and n-tier models through the concept of
mobile objects. This provides the flexibility to optimize performance,
scalability, security and fault tolerance with no changes to code in the UI
or business objects"

Bart
Back to top
Bob Dawson
Guest





PostPosted: Fri Jan 19, 2007 1:14 am    Post subject: Re: TDataModule as Persistence Manager Reply with quote

"Bart" wrote

The important bit:

Quote:
"The framework
is designed to enable single tier and n-tier models through the concept of
mobile objects."

CSLA doesn't care what the ultimate persistence layer is, but then neither
does it provide it.

My caution that it's not really a persistence layer is based on direct
conversation with the author--who corrected me when I made the same mistake.
I had lunch with him at a conference last spring. After adopting CSLA you
still have to provide the persistence layer on the back end.

For a discussion of using both CSLA and a persistence framework at the same
time, google 'CSLA NHibernate'.

bobD
Back to top
Bart
Guest





PostPosted: Fri Jan 19, 2007 1:37 am    Post subject: Re: TDataModule as Persistence Manager Reply with quote

Quote:
My caution that it's not really a persistence layer is based on direct
conversation with the author--who corrected me when I made the same
mistake.
I had lunch with him at a conference last spring. After adopting CSLA you
still have to provide the persistence layer on the back end.


Thank you for clearing this.

Bart
Back to top
Bob Dawson
Guest





PostPosted: Fri Jan 19, 2007 10:58 pm    Post subject: Re: TDataModule as Persistence Manager Reply with quote

"Bart" wrote
Quote:

Thank you for clearing this.

No problem.

And I didn't mean to slight CSLA. There is a lot of functionality in CSLA in
terms of support for business rules, object validation, etc.--much of the
business of a business object layer. It's just that if you're interested in
studying an OPF codebase specifically, it's probably not a good candidate.

In the .NET realm I'd probably recommend Gentle.NET as something to look at:
http://sourceforge.net/projects/gopf
http://www.mertner.com/confluence/dashboard.action

There's a pretty good review of .NET ORMs here if gentle in particular
doesn't appeal to you
http://www.howtoselectguides.com/dotnet/ormapping/

A lot of core OPF thinking traces back to Scott Ambler's paper
http://www.ambysoft.com/downloads/persistenceLayer.pdf

His site has several interesting papers to read besides that one.

Best source I know for OPF references and design discussions in Delphi is
this forum.

bobD
Back to top
Andrea Raimondi
Guest





PostPosted: Wed Jan 24, 2007 9:16 am    Post subject: Re: TDataModule as Persistence Manager Reply with quote

Hi Mark,

Personally, I use this approach:

TDataModule->Opf classes

I define my "operations" in the Datamodule and then call the opf
classes internally to actually do them.

It's a flexible approach and works.

Cheers,

Andrew
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi OO design All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.