What entity is responsilbe for an action? A Design Question.

What entity is responsilbe for an action? A Design Question.

Old forum URL: forums.lhotka.net/forums/t/1030.aspx


slabanum posted on Friday, August 25, 2006

Hi,

I have a project where I have a ValidationCase object which contains ExceptionEntries collection of ExceptionEntry.  I start off with a ValiationCase being populated already and presented on a GUI and the client user works on it:

  1. The client user does some manual checking on the ExceptionEntries, decides that they are okay and flags the ExceptionEntries as a Valid state. 
  2. The client user then does a ValidationCase.Save().  This call goes to the RemotingHost and executes a DataPortal_Update.  It is determined that all ExceptionEntries at this point are Valid so the ValidationCase is flagged as a "Valid" state. 
  3. Due to the ValidationCase being flagged into a Valid state, there is a side effect where another process is kicked-off, like when the ValidationCase's State is Valid then run the Batch Calculation Process.

My question is since the saving of the ValidationCase to a Valid State has a side-effect of running another process, should this behavior of determining when another process is kicked-off the responsibility of the ValidationCase?

I am kind of feeling that this is the ValidationCase's responsibility since it knows it's own state.  But then again, this kicking-off of a new process is something like a workflow that can be orchestrated outside the ValidationCase, hence another object should be the one responsible for this workflow processing.

If it is indeed another objects responsibility and not the ValidationCase, how then can I tie a client user clicking a save on the ValidationCase to this workflow process manager.  Any patterns you can suggest?

Please provide some thoughts.

Thank you.

 

 

 

Copyright (c) Marimer LLC