Post #194,368
2/12/05 2:09:08 PM
|
Sounds reasonable
Looks like C# has [link|http://www.ondotnet.com/pub/a/dotnet/2003/03/10/collections.html|type-safe collections]...maybe you can put all of your Domain Object properties into a private HashTable*, and then write public getters/setters which are Null-aware? Just a thought.
Re: the dirty logic:
If you are making an [link|http://www.martinfowler.com/eaaCatalog/activeRecord.html|Active Record] system, you might as well stick as much logic into the objects themselves.
If, on the other hand, you're making a [link|http://www.martinfowler.com/eaaCatalog/dataMapper.html|Data Mapper], you probably want to keep the "dirty logic" (whether an object has changed or not) outside your custom "value type" objects. It will make it easier for your mapper to instantiate existing objects without having them become dirty unwittingly, especially if you start adding update triggers.
* Yes, I'm forever tainted by Python ;)
|
Post #194,509
2/14/05 4:15:32 AM
|
Wibble, wibble...
Brewski Bob blithers: Looks like C# has [link|http://www.ondotnet.com/pub/a/dotnet/2003/03/10/collections.html|type-safe collections]...maybe you can put all of your Domain Object properties into a private HashTable*, and then write public getters/setters which are Null-aware? Just a thought. If that's all there's to it, then those aren't "properties". They're just private values that happen to have public getters and setters; a mere (stupid, Java-ish) *convention* -- not *actual implemented as such* properties at all. (Oh well; then again, I know of only one language that actually *does* implement a proper property mechanism...) If you are making an [link|http://www.martinfowler.com/eaaCatalog/activeRecord.html|Active Record] system, you might as well stick as much logic into the objects themselves. As much as what?
[link|mailto:MyUserId@MyISP.CountryCode|Christian R. Conrad] (I live in Finland, and my e-mail in-box is at the Saunalahti company.)
Your lies are of Microsoftian Scale and boring to boot. Your 'depression' may be the closest you ever come to recognizing truth: you have no 'inferiority complex', you are inferior - and something inside you recognizes this. - [link|http://z.iwethey.org/forums/render/content/show?contentid=71575|Ashton Brown]
|
Post #194,553
2/14/05 11:17:46 AM
|
Semantics
Call them whatever you want if they get the job done.
I meant "as you like", by the way.
|
Post #194,623
2/14/05 5:13:14 PM
|
A) Almost everything is, when you get down to it; and B)...
...everybody seems to be leaving off "as possible", nowadays.
Well, not *everybody* -- it seems to be Amer\ufffdcans, mostly. (I could say something about attention spans, here... But I'll leave you to come up with that for yourselves.)
[link|mailto:MyUserId@MyISP.CountryCode|Christian R. Conrad] (I live in Finland, and my e-mail in-box is at the Saunalahti company.)
Your lies are of Microsoftian Scale and boring to boot. Your 'depression' may be the closest you ever come to recognizing truth: you have no 'inferiority complex', you are inferior - and something inside you recognizes this. - [link|http://z.iwethey.org/forums/render/content/show?contentid=71575|Ashton Brown]
|
Post #194,706
2/15/05 12:54:43 AM
|
English is simply too flexible to be used well.
I think the problem comes up when typing such a phrase because English freely allows two different, yet equal, arrangements:
"stick as much logic [as possible] into the objects themselves"
and
"stick as much logic into the objects themselves [as possible]"
While typing, it's easy to *intend* to place the "as possible" at the end of the sentence, and then forget to do so, because your brain tricks you into thinking you already inserted "as possible" into the first slot.
Not that English is the only such language, but I think that's why I elided the words.
|
Post #194,712
2/15/05 2:41:54 AM
|
Yeah, I know - but it makes for a funny contrast...
...with German, where the grammar dictates that such spans are much more frequent, and much longer -- and you hardly ever see Germans leave off such a possibly tiny, but nonetheless vital, part.
(Then again, this could be because in German, such a fragment almost always *has* to go on the end of the sentence; which means there is a much smaller risk of thinking one has already added it.)
[link|mailto:MyUserId@MyISP.CountryCode|Christian R. Conrad] (I live in Finland, and my e-mail in-box is at the Saunalahti company.)
Your lies are of Microsoftian Scale and boring to boot. Your 'depression' may be the closest you ever come to recognizing truth: you have no 'inferiority complex', you are inferior - and something inside you recognizes this. - [link|http://z.iwethey.org/forums/render/content/show?contentid=71575|Ashton Brown]
|
Post #194,758
2/15/05 11:11:25 AM
|
Re: Sounds reasonable
If, on the other hand, you're making a Data Mapper [*], you probably want to keep the "dirty logic" (whether an object has changed or not) outside your custom "value type" objects. It will make it easier for your mapper to instantiate existing objects without having them become dirty unwittingly, especially if you start adding update triggers.
I am using a Data Mapper, but my mapper uses reflection and puts the data directly into the private fields, bypassing the "dirty logic". It's currently designed so my domain objects keep a map of original values and that is populated when property change events are fired. I think using the value objects will simplify this.
|