Search the web
Sign In
New User? Sign Up
agilemodeling · Agile Modeling
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Want to share photos of your group with the world? Add a group photo to Flickr.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Want an answer   Message List  
Reply | Forward Message #7310 of 8924 |
Re: [AM] Want an answer

don't fall off your chairs...

re: " I have in the past had long debates over whether or not the domain
object should know about persistence at all."

but i have *successfully abused inheritance* in the past to achieve an
interesting mix (for thin client/web apps).

* Xyz Domain Class
o can live on server or client
o has the usual: properties and accessors
o business methods
o associations to other objects
o often employs lazy loading
o knows NOTHING about DBs
* Xyz Business Class
o *INHERITS* from the Domain Class
+ Gets all of the class properties that way :-)
o Knows about persistence classed (DGs/DAOs)
o has the persistent ID
o can get itself from the DB via an ID
o can save() itself to DB
* Xyz Transfer Object
o small thing to meet some need of going between UI and server
o used typically when the Domain Object is too big and you
want specialized sets of properties filled in
* Xyz Identifier Class
o really tiny thing
o usually just an ID and a string
o sometimes a few other things
o used for lightweight lists of associated classes
+ to drive drop-downs
+ typically used in conjunction with lazy loading

<gulp> there, i've confessed.

jon
blog: http://technicaldebt.com



Paul Oldfield said the following on 4/7/08 4:42 AM:
>
> (responding to John
> >
> >
> > I think it's never a great idea to embed persistence in domain
> > objects. Sometimes I have done this, merely as a convenience
> > when the application was small and there was no need for
> > long-term maintenance or expansion of functionality. But
> > generally, persistence should be separated from the domain
> > objects, because it leads to loose coupling, and a cleaner
> > and more flexible design.
>
> Agreed. I advocate encapsulating persistence, but not
> embedding it. The Strategy pattern allows me to do this.
> I hope you understand the distinction...
>
> Domain Object: "Here's my object that deals with all
> my persistence needs. I don't know how it does that: I
> don't care. But I don't want anyone else to get to talk
> to it; who knows what they'd do?"
>
> I have in the past had long debates over whether or not
> the domain object should know about persistence at all.
> I'm not convinced there's a right answer, or if there
> is I haven't come across it yet. I always choose an
> approach that works in the specific context.
>
> I've dabbled with compound objects that implement the domain
> object interface and also a transactional interface; I
> like this approach provided I can auto-generate the code
> for all the classes of compound objects I'd need. Aspect
> Oriented programming might help here - I don't know enough
> about it to say either way.
>
> > A File object is fundamentally a data object. It should
> > not contain services for interacting with the file system.
> > A file system is a manager of files, which provides a
> > bundle of services for discovering and manipulating files.
>
> I disagree. The term "File" comes from a domain that is
> about information storage. A File belongs on a filing
> system. We choose to put information in a File because we
> want to be able to store it. I agree that there are also
> data objects that should have no need to interact with
> the filing system. We put these data objects into a file
> when we want to store them in a filing system.
>
> > Test-driven development leads to the proper design, because
> > person.persist() does not suggest an obvious way to test
> > for the expected functionality, but
> > PersistentService.persist(person) does, because through the
> > persistence manager, you can check to verify the person was
> > actually persisted.
>
> I think about this in a different way. You might not agree
> that it's better, but it works for me. I think of a real
> world object as something that intrinsically persists. I
> think that any change to the data of a computerised object
> representing this real world object should persist by default.
> The object can, of course, know when its data has changed.
> It can ensure that these changes persist without needing to
> be told to do so.
>
> The problem arises with Transactional sytems, where we want
> to ensure that the model of the real world does not get
> out of step with the real world... say by one account taking
> in some money without the other account releasing hold of
> it. Real world? Think of two hands both holding on to
> the same gold coin... With Transactional systems we need
> all parties to the transaction to agree that the transaction
> has, or has not, taken place. Some people choose to do this
> by exposing aspects of the persistence of objects.
>
> The rest is down to design solutions that try and optimise
> the relatively high overheads of communicating with any
> persistant storage.
>
> And anyway, the only real test of Persistence is to turn
> the system off and back on again.
>
> > I don't see how this issue has anything to do with
> > polymorphism...
> > ... Traits, duck typing, and
> > delegation address the problem in a maintainable way.
>
> Hmm... I view inheritance and delegation as alternate ways
> to implement polymorphism, but maybe I'm out of step with
> common usage of the term?
>
> Paul Oldfield
>
>



Mon Apr 7, 2008 2:35 pm

jonkernpa
Offline Offline
Send Email Send Email

Forward
Message #7310 of 8924 |
Expand Messages Author Sort by Date

Hi! so mean a coworker were discussing objects. I favour 'light' objects basically typed data containers with basic functionality (IsValid()etc). then have a...
Mister Mr
mrrichmond2003
Offline Send Email
Apr 2, 2008
11:38 pm

(responding to Mister Mr) ... I favour, as an ideal, exposing as little as possible of how an object works to anything that uses that object. I ask myself; "If...
Paul Oldfield
pauloldfield1
Offline Send Email
Apr 3, 2008
8:19 am

(responding to Mister Mr) ... Another comment; I'm not in favour of objects that can change their 'identity' once exposed to a client. In "his way" you create...
Paul Oldfield
pauloldfield1
Offline Send Email
Apr 3, 2008
8:58 am

... I agree with you Paul, but it must be said that... This notion of having a strong identification scheme for objects is *not* a concept that's typical of...
Clifford Heath
clifford_heath4
Offline Send Email
Apr 3, 2008
9:29 am

(responding to Clifford) ... Agreed. 'Real World', physical objects tend to have an identity so strongly tied to the molecules of which they comprise that they...
Paul Oldfield
pauloldfield1
Offline Send Email
Apr 3, 2008
10:33 am

... Actually, even that isn't really true. The atoms in the human body are replaced, in the average across the whole organism, every six months. Some parts...
Clifford Heath
clifford_heath4
Offline Send Email
Apr 3, 2008
10:58 am

... agilem> whole organism, every six months. Some parts have ... That is very interesting and brings me to a few other examples. Is a park bench still a park...
David Stanek
roninds0
Offline Send Email
Apr 3, 2008
11:22 am

(responding to David) ... Off the top of my head and without studying the books on Philosophy, I suspect that all objects that we can identify as such have a...
Paul Oldfield
pauloldfield1
Offline Send Email
Apr 3, 2008
11:50 am

(responding to Clifford) ... Agreed; there are many exceptions and variations which is why I use the expression "tend to". ... Hmm... perhaps the notion of an...
Paul Oldfield
pauloldfield1
Offline Send Email
Apr 3, 2008
11:37 am

... This is often because of the incredibly narrow focus of the data community. When you only consider data issues this strategy MIGHT make sense. Sometimes ...
Scott Ambler
scottwambler
Offline Send Email
Apr 3, 2008
11:11 pm

light objects are useful as transfer objects (that is, server to UI). however, in a full OO implementation: * lightweight objects are suspect as being simple...
Jon Kern
jonkernpa
Offline Send Email
Apr 3, 2008
1:33 pm

Hello, Mister. On Wednesday, April 2, 2008, at 6:44:53 PM, you ... I was taught that objects named XxxManager were a sign of poor object design. Often they...
Ron Jeffries
ronaldejeffries
Offline Send Email
Apr 3, 2008
2:08 pm

Here's an ancient blog post I wrote on the issue. Warning: I don't always agree with younger versions of myself. But in this case, I do agree with one thing:...
John A. De Goes
jdegoes
Online Now Send Email
Apr 3, 2008
3:17 pm

(responding to John A. De Goes) ... (well snipped...) I'm happy about use of managers or the like where appropriate, but not about exposing them to client...
Paul Oldfield
pauloldfield1
Offline Send Email
Apr 4, 2008
6:46 am

I think it's never a great idea to embed persistence in domain objects. Sometimes I have done this, merely as a convenience when the application was small and...
John A. De Goes
jdegoes
Online Now Send Email
Apr 6, 2008
7:14 pm

... I agree, on the grounds of proper separation of concerns. Domain objects should only be concerned with the problem/requirements space, whereas persistence...
Ashley at Metamaxim
keplervic
Offline Send Email
Apr 6, 2008
9:05 pm

(responding to John ... Agreed. I advocate encapsulating persistence, but not embedding it. The Strategy pattern allows me to do this. I hope you understand...
Paul Oldfield
pauloldfield1
Offline Send Email
Apr 7, 2008
8:42 am

don't fall off your chairs... re: " I have in the past had long debates over whether or not the domain object should know about persistence at all." but i have...
Jon Kern
jonkernpa
Offline Send Email
Apr 7, 2008
2:45 pm

Hi Paul, File is a word we use to denote a hierarchical resource. It should not matter to a developer where that resource is physically located. Consequently,...
John A. De Goes
jdegoes
Online Now Send Email
Apr 18, 2008
4:02 pm

Hi all .. Thanx to all that answered.. I don't agree with coupling the database code within the object. Aside from database specifics (which can be factored...
Mister Mr
mrrichmond2003
Offline Send Email
Apr 4, 2008
1:24 am

(responding to Mister Mr) ... Hmm... you mention the Strategy pattern but don't seen to see how this can be used to remove the second lot of responsibilities...
Paul Oldfield
pauloldfield1
Offline Send Email
Apr 4, 2008
6:58 am

... I've used Strategy to plug in various alternative storage and retrieval objects. It certainly doesn't solve everything. I would certainly allow them to...
Ron Jeffries
ronaldejeffries
Offline Send Email
Apr 4, 2008
11:07 am

... neither? both? depends on the full context of the real app. you have heard many of us be against the manager class concept... so it seems to me to lean...
Jon Kern
jonkernpa
Offline Send Email
Apr 4, 2008
5:16 pm

Hi! Once again! Thanx to everyone that answered!. I'm certainly missing something... so whats the short answer (maybe a web link to elaborate) as to why the...
Mister Mr
mrrichmond2003
Offline Send Email
Apr 4, 2008
9:29 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help