Workflow Patterns

D

danths

Hello,
In a workflow application where in the workflow is customizable, i
would like to defer the instantiation of the class till the workflow is
complete. e.g.

class ClassA {
object1 objA;
object2 objB;
object3 obj3;
ClassA( object1 v1, object2 v2, object3 v3)
{
object1 = v1;
...
object3 = v3;
}

}

Any of the above three member variables could be instantiated first and
hence there are nine combinations. The three member variables are being
instantiated in three diferent forms in a wizard like app.

Since I wanted to keep the model seperate from the view, how could I
defer the instantiation of the ClassA but still keep the controller
generic enough so that the order in which the member varibles are
collected is not sequenced. I read that "Collecting Parameter" pattern
supports something similar to this, however I am not too sure since I
couldn't find the right examples. BTW: I am writing this in C# and so
any other alternatives are welcome as well.

Thanks
sd
 
N

Nick Malik [Microsoft]

When you put up "workflow patterns, " I got my hopes up you'd be talking
about the workflow patterns described here:
http://is.tm.tue.nl/research/patterns/

As for your problem, you have data that collects over time... so have two
classes. One that simply holds the objects that you are instantiating, and
the other that will be your 'A' object below:

class myParameters
{
public myObjectA A;
public myObjectB B;
public myObjectC C;
}

class myNewObject
{
private myObjectA _A;
private myObjectB _B;
private myObjectC _C;
public myNewObject(myParameters parms)
{
_A = parms.A;
_B = parms.B;
_C = parms.C;
}
// ..... other useful stuff
}

--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
 
D

danths

Thx! for the reply. I was looking at the same link for the past two
days. The solution that you have recommended warrants that I repeat the
code. I have 23 member variables right now, should I be repeating all
the 23 variables in two different classes.

Thanks
danths
 
N

Nick Malik [Microsoft]

danths said:
Thx! for the reply. I was looking at the same link for the past two
days.

I admit to a little envy that the YAWL folks chose to implement in Java. If
they had picked .Net, I would have really loved to have used it.
The solution that you have recommended warrants that I repeat the
code.

I cannot imagine why.
I have 23 member variables right now, should I be repeating all
the 23 variables in two different classes.

Please explain.

--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
 
D

danths

Wouldn't I have to code all the member variables which are needed in
myNewObject also at myParameters. But your recommendation sparked a
slight modified version of the design i.e. why not make myParameters
also a member variable of myNewObject , that way I would not have to
create teh same member variables in two different classes.

Thanks
sd
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top