I'm glad I was wrong, FWIW, because this is cool. Sort of puts
another nail in the coffin of the notion that Transfer requires King
Database and puts the database before the object model.
I'm going to try to write a sample application that goes thru the
process of setting up a Transfer-based app without using a service
layer at all, just real, behavior-laden domain objects... because
there's no reason that Transfer can't take the place of the service
layer and the persistence layer all at the same time. Should be
interesting.
Laterz,
J
On Nov 19, 2008, at 11:45 AM, Bob Silverberg wrote:
>
> I like this idea. I can see how some might see it as a misuse of the
> ORM, but it seems like a very practical approach to me, and keeps
> things consistent (i.e., all Business Objects are Transfer Objects).
>
> Thanks for sharing,
> Bob
>
> On Wed, Nov 19, 2008 at 11:05 AM, John K. <rayra...@gmail.com>
> wrote:
>>
>> I didn't mean to make anyone go out and code this up for me to see if
>> it worked, I was really just curious how others handled this problem.
>> Thanks for trying it out though Chris! ...
The only thing that get's a little messy, in my implementation, is the
fact that I have my application set up with MG and CS and so I have
the view, controllers, services, and then gateways/dao's. Instead of
exposing Transfer to the service level and using it to replace all my
gateway/dao functionality, I expose Transfer at the gateway/dao level
as more of a wrapper. Change the ORM, change the gateways/daos
instead of the entire service layer. You might be able to imagine how
this kind of creates some goofiness as I have to have a method in the
gateway that creates the empty Transfer object for me. It works, but
I'm not entirely happy with it at the moment.
Then again, I'm still giving this a lot of thought. "Real" OOP has
caught my attention lately mostly due to Joe Rinehart's ORM posts and
Hal Helms's responses... it's gotten me thinking about Hal's
objection to Transfer as a DB-centric device that's anathema to
"really good OO domain models". I also have no real training in
programming, so I tend to make a lot of this stuff up as I go. So
take this all for what it is (and what it's worth): My own (probably
uninformed) take on what I see as valuable in application
architecture. I'll be the first to admit that a lot my observations
over the last 2 years have met with some strong resistance from
friends and colleagues, so it's hard to know if I'm being less a
follower of entrenched thinking than they are or if I'm so far off
base that I should be locked in a padded cell and the key ground to
powder. ;)
So yeah, maybe I've a screw loose... it's happened before, but I am
thinking that if Transfer is acting as both the object factory for
business objects and the persistence API it sort of makes a more
traditional service/persistence mechanism, well, redundant. If the
controller is doing nothing but pulling values from the event and
dumping them into the service layer and then pulling data from the
service layer and pushing them to the view, where's the value in
having service classes and DAO and/or Gateway classes?
I guess what I'm thinking is that if you have all the behavoirs the
application needs encapsulated within the domain objects and the
those objects are all served up and persisted by Transfer, what value
is a separate service layer and CRUD layer? This has far less to do
with OOP than it does stable application architecture. I know even
Mark uses the DAO/Gw pattern and the Manager pattern (albeit referred
to as Services), but I'm starting to wonder if that's the right
direction. I have to read some more and talk about this with some folks.
Thoughts?
J
On Nov 19, 2008, at 12:39 PM, Bob Silverberg wrote:
>
> So you'd have your controller talking directly to Transfer? Is
> that the idea?
>
> On Wed, Nov 19, 2008 at 1:26 PM, Jared Rypka-Hauer
> <armcha...@gmail.com> wrote:
>>
>> It depends on how you look at it, if ORM is object --> relational,
>> then it's no misuse at all, you're using Transfer as an object
>> factory to get your business objects and if they happen to have
>> persistence integration well that's cool. ...
I'm pulling from both the text and Mark's comments in these two blog
posts for a lot of what I'm about to say:
http://www.firemoss.com/post.cfm/does-coldfusion-have-no-real-orm-
frameworks
http://www.firemoss.com/post.cfm/what-makes-a-framework-an-orm
What I'm hoping will come of this is that Transfer will eventually
include an object factory as well as a persistence mechanism. Mark
has already said he's looking at several enhancements to future
versions of Transfer to include inheritance mapping and hopefully
eventually enhancements to allow things like bidi m2m joins.
Granularity needs to be on the map so you can define 2 or 3 objects
from one table, but I don't see that as insurmountable... maybe I'm
wrong but still, it doesn't seem that far fetched.
Hell, if I could make sense of the Transfer codebase (which is only
function matter of time and effort on my part) I'd be more than
willing to help add things like granularity to the framework, and
allow the addition of objects to the factory that aren't included in
the persistence scheme. Things like adding an object definition to
the Transfer config without a table="" attribute means that the
object is treated as a plain old ColdFusion object. Adding property
tags with a ref="" attribute would allow you to associate these
objects with other objects and intermingle the persistence tools with
the object factory tools. It would still allow Transfer to generate
many of the methods, even retaining the m2m, m2o and o2m terminology
to create collections of other objects... I see this working very
well and allowing Transfer to fill a need that's been around since
ColdSpring gained fame and fortune: acting as an object factory for
transient objects.
I also don't think it would be out of line to contemplate Transfer
being able to support a columns="" attribute to create a solution to
the granularity problem, or, possibly, adding subordinate objects to
the object definitions to be able to accomplish it. Doing it with
subtags would mean you'd be able to, using Joe's example from the
Granularity section of the second blog post, define a User that is
composed of simple properties and larger properties. Being able to
define things to this level means Transfer would be an "all-the-way"
sort of solution, not a partial solution for most things you need to do.
I have to admit I'm utterly, totally psyched about the idea,
especially with Transfer promising to generate DDL to create the DB
from the model and inheritance mapping. To see Transfer become
something that solves so many obvious needs, fully implemented and
roaring to go, is something that I find exciting on so many levels.
Laterz,
J
On Nov 19, 2008, at 3:03 PM, Elliott Sprehn wrote:
>
> What worries me the most about about this idea is that it utterly
> breaks the insides of Transfer on a global scale. Essentially the
> entire public API that it provides won't work. That is, readByProperty
> () , readByPropertyMap(), TQL, saving, deleting, relationships...
> won't work. And it won't just fail silently, Transfer will throw nasty
> exceptions from the database. ...