Modelling patterns part 2

First issue here is about an actual pattern. It could be name as Reservation pattern. It deals with two event objects: reservation and participation. In many cases of participation to an event is quite simple a capacity reservation object with only one attribute -time.

In most cases my recommendation is to combine these two events. This means theoretically that we interpret that the participation event is created before it actually happens. This participation will now housing also the attributes of reservation. This is a very effective simplification with no drawbacks. This way we can save one class and three associations and that is a lot!

This solution can be applied to variety of participation events like participations to a flight, a concert, a play, a party and it can be extended to cover even a stay in a hotel.

There is also a other issue that want to take up with you. This is more of a fragment of almost every business domain model. I will call this “person- organisation” pattern. In my very first implemented domain model in Finnair 1994 I was so inexperienced and at the beginning of my OO learning curve that I created the following class model:

and it proved to be inadequate  as soon as the application was taken to production and almost first user came and asked how do I put Nokia here!

of course the far more correct model is the following:

Here a bit more elements than just the role organisation.


2 Responses

  1. Continuing the reservation pattern a bit, for me this highlights so called lifecycle issue.
    I mean that quite often when discussing with people they talk about the numerous objects they have in the domain, but for me some of these objects reflect different kinds of life cycle statuses, which should perhaps ne modeled as one rather than many.

    Thinking that an event has several lifecycle states (planned, in progress, etc.) the state transitions have conceptual impacts on the related objects. For example when an event is started, participation status of the persons present will be changed from reserved to perticipated. Is thi show youäd do it or is there a flaw in my thinking? I am not that much of an expert in OO, so tell me how would you model such.

    • Hi Jukka
      I think you have got it quite right. What I would like to (always ) emphasise is the equivalence of a identity and a class in the model. The very fundamental premise of OO is to respect identity of every object. There is the first compulsory rule: Object cannot change class during its life cycle! The model must be structured in a way that every object of the domain always is born and dies in the same class.
      So the participation-event object –as all event type objects have start time and end time attributes. This fact gives us a possibility to create the object before it actually happens. In this case its state – i.e. life cycle point – could be called for instance “planned” or “coming” or in the case of participation “reserved”.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: