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.
|










