The Design of Software (CLOSED)

A public forum for discussing the design of software, from the user interface to the code architecture. Now closed.

The "Design of Software" discussion group has been merged with the main Joel on Software discussion group.

The archives will remain online indefinitely.

Name this pattern!

Hi, I'd like some help from the other readers in order to find out what the name for this pattern is.
I've used it twice (one telecom configuration project and now in a sort of simple workflow subsystem) and I suppose it's pretty common knowledge... but by finding out the correct name I may perhaps find more about it over the net.

Basically the idea is as follows:
I have one header record with a status code (open, work-in-progress, pending, closed etc.).
A set of 0-n records (items) are linked to this header, each item may be in one of several states (new, closed, error, verified etc.). This too, at the level of the item record, is modeled with a status code.

The status code of the header is a function of the state of all its linked items. For example "if at least one item has <<error>> status, header will be in status "pending".

Each time one of the linked items changes status, header status will be re-evaluated.

Is there a name for this pattern?
Paolo Marino Send private email
Tuesday, March 21, 2006
doesn't look like any of the 'classic' design patterns, but partly reminds me State and maybe Blackboard patterns. google for them to see if they suit your situation.
Tuesday, March 21, 2006
Thom Lawrence Send private email
Tuesday, March 21, 2006
Composite could be a good match, but there seems to be nothing in particular about state (or any other value of the composite) being a function of the state of the subelements, which to me seemed the whole point of this.
Paolo Marino Send private email
Tuesday, March 21, 2006
This sounds a little like an observer/state pattern with a composite, since you're notifying the other objects when the header status is changed.
QADude Send private email
Tuesday, March 21, 2006
I dont know what its called but my application has this same notion all over the place.
NetFreak Send private email
Tuesday, March 21, 2006
Forward chaining.
Karel Thönissen Send private email
Tuesday, March 21, 2006

It's a combination of Observer and State patterns.
Observer because, Header's state is updated whenever the linked items change state.
State pattern because, Header shifts between different pre-defined states.
Ashwin Send private email
Wednesday, March 22, 2006
Thanks to all who contributed...

I am a bit surprised that concepts like the one I presented don't seem to be "worthy" of a specific denomination... is this due to lack of consensus about what should be a pattern and what doesn't deserve classification or am I missing the point?

As someone else noted, this idea is used all over his application. I think it is useful, simple, and versatile enough to qualify as a pattern in itself... but in order to convey the concept in a concise way, I find monickers like "you know, the State/Composite/Observer thingy we read about in JoS" a bit lacking.

Is there a way to get this accepted as an "official" pattern? Where should I apply?
Paolo Marino Send private email
Wednesday, March 22, 2006

There are really hundreds of design patterns. The 23 in the GoF book are just scratching the surface. Many useful patterns do not have a name.

Although this is a special case of forward chaining, I think it deserves a name in its own right.

Here you will find many more:
Karel Thönissen Send private email
Wednesday, March 22, 2006

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics
Powered by FogBugz