--- On Sat, 1/30/10, David E Jones <d...@me.com> wrote:
> On Jan 30, 2010, at 8:30 PM, Adrian Crum wrote:
> > The moral of the story is: developers shouldn't be
> allowed to write to the service context Map. If a service
> needs a Map for local storage, then it should create one.
> 
> That's kind of interesting.
> 
> What got me thinking is that the normal practice for Java
> service is to create a local variable for pretty much
> everything in the context anyway (ie like: String partyId =
> (String) context.get("partyId");), and there are things like
> that all over the place.
> 
> As far as not being to write to the context... why not?
> Sometimes it's handy to use the current context as the basis
> for calling another service. There are certainly other ways
> to go about that... but...

Maybe it would help to step back a little and compare OFBiz back in the day 
when it was just David and Andrew, and what it is today. Back then using a Map 
for passing parameters was a cool idea. I don't know what the motivation was to 
use a Map to pass parameters when you designed the service engine, but at the 
time I'm sure the two of you knew that you weren't supposed to write to it.

Today, things are different. We have a lot of contributors. Many of those 
contributors might not know everything they need to know about the framework. 
So, the framework needs to protect itself from inexperienced or lazy 
developers. That was the moral of the story.

I made the changes Adam suggested in this thread because I agree with the 
concept he was promoting: Make the framework code impose rules that developers 
must follow. As the OFBiz code base and community grows, I'm sure we will need 
to do more of the same.

-Adrian



      

Reply via email to