evaristo 0 Newbie Poster

The solution present at Apache Commons Chain design pattern library has taken me to consider the broad use of context objects as a mean for decoupling my class objects. In other words, all i need is a set of interfaces which my objects expect to get a handle from the context being passed to them, and this way i don't have those long method signatures:

public void doIt(EnvironmentInterface env, Doer doer, DataStuff data, AnotherDataStuff data2){...}

public void doIt(ContextInterface ctx)
{
   EnvironmentInterface env = ctx.get(MyContextEnum.ENVIRONMENT_OBJ);
   DataStuff data = ctx.get(MyContextEnum.DATASTUFF_OBJ);
   ...
}

...am i being too simplistic. I still haven't found a problem with this but i'm seeing this as being to simple to be too good.
What do other members think about this issue, do any of you have a secret recipe for this kind of situations?

Best regards
evaristo

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.