I have spent the last month with some really smart guys who have been tasked to distill a problem domain into connected domain-neutral components. All of them have had years of experience modeling domains; however, this exercise represents their introduction to modeling in color. As such, they have challenged my articulations of the domain-neutral component. I address one such challenge in this post: date effectiveness and the «moment-interval» class archetype.
I present the definitions of the «moment-interval», again:
a moment-interval represents something that one needs to work with and track for business and legal reasons, something that occurs at a moment in time or over an interval of time.
Stephen R. Palmer expands on this in his online article The Moment-Interval Class Archetype:
For a class to belong to the Moment-Interval class archetype it must firstly be some recognizable instant (moment) in time or duration (interval) of time, an event or activity that we can give a name. However, this is not sufficient. The class must also be an (sic) moment or interval that we need to work with or remember in our field of endeavor (our problem domain). If the instant or period of time is not relevant to the domain that we are working in, then the concept is either not worth representing in our software or the concept, in our domain, belongs to a different class archetype.
The idea of date-effective entities manifests itself in almost every non-trivial problem domain. Sometimes, our software allows temporary delegation of a role from one person to another, for example, when a person goes on vacation and wants another to do her job so the business does not come to a grinding halt. In another case, we may reference a schedule of currency conversion rates that apply for only a day, an hour, or a 15-minute interval.
Sometimes, we want a history of date-effective entities. From our example, I could see a need by Infernal Compliance to audit the delegations performed over the past year to ensure segregation of duties. That does not require us to promote the notion to use the «moment-interval» class archetype. Instead, we just do what we would normally do: maintain a historical record of assignments. We manage a list instead of a single instance.
With regards to these two ideas, we seem to have an overlap of definitions when it comes to intervals of time. The distinction comes from the inherent purpose of the idea; we use the following question to distinguish between a date-effective entity and a «moment-interval»:
Must the idea that we’re trying to model have a moment of time or an interval of time for it to make sense, not just within our problem domain, but in the world?
If the idea we want to model requires that time element to exist, then we have a «moment-interval»; otherwise, we just have a date-effective entity.
For example, the bill that you receive from your utility company has an associated time period. Without that time period, the invoice makes no sense. You would say, “Why did I get this bill? I don’t see the dates for which it applies. I don’t know what I need to pay, here.”
As another example, if you have decided to build the next generation social networking application, then the moment in time that two people “friend” one another would represent a first-order concept in your problem domain. You would need to track that because it signifies a core principle of your application.
On the other hand, when you go on vacation and you delegate approval authority for requests from your team to me, then we have a date effective relationship between that permission and my user account. The privilege exists separately from the notion of a moment in or interval of time. It just means that the role that I temporarily have allows me to participate in request approvals. When the assignment expires, the privilege still exists; it just does not exist with my user account anymore.
When, in our domain, we want to apply time constraints to the participation of a «thing» in a «moment-interval», then we have found a date effective entity.
When we have an idea intractable from the moment in time or interval of time that it describes, then we have a «moment-interval».