Special

Clearance Sale!

We've been publishing for over five years now and it's time to clear out our inventory of back issues, so we're slashing prices!

RBD Magazines

Check out this amazing clearance sale of all our past issues. Missing some issues? This is a great time to complete your RBD collection. Save up to 40% off the regular price of our printed back issue packages. These prices are only good until the end of the year May 2008 and supplies are limited, so place your order today.

Article Preview


Buy Now

Print:
PDF:

Object-Oriented Thinking

Better Dating

Issue: 2.6 (July/August 2004)
Author: Charles Yeomans
Author Bio: Charles Yeomans pontificates on REALbasic from Lexington, Kentucky
Article Description: No description available.
Article Length (in bytes): 5,029
Starting Page Number: 33
RBD Number: 2617
Resource File(s): None
Related Link(s): None
Known Limitations: None

Excerpt of article text...

Why doesn't setting FolderItem.ModificationDate.TotalSeconds change the modification date of a FolderItem? More importantly, why shouldn't it?

The answer to the first question is simple enough; FolderItem.ModificationDate is not returning the same Date object that it might be holding internally. To answer the second question, let's suppose that it did. This would mean that any other object could call FolderItem.ModificationDate to get that Date reference, and then pass it around the program. Later on, some other object might modify that Date object, unintentionally changing the modification date of the FolderItem.

To better understand the situation here, we need to consider the concept of a value object. Recall that objects are determined by state, capability, and identity. Value objects are determined by state and capability only. Or, to put it tautologically, value objects are objects that represent values. Examples of such classes might include PhoneNumber, or Money. Date is another example.

...End of Excerpt. Please purchase the magazine to read the full article.

Article copyrighted by REALbasic Developer magazine. All rights reserved.


 


|

 


Weblog Commenting and Trackback by HaloScan.com