Current Context in Libraries

  • Thread starter Thread starter Ray Booysen
  • Start date Start date
R

Ray Booysen

Hi all

I have a question. I have a library in my webapp (1.1) that requires
access to certain application cache and session variables. At the
moment, I have been passing these in as parameters to the function.

Could I pass in the current context to access these variables directly?
Or is this not "a good thing?"

Any help would be great.

Regards
Ray
 
your current approach is better from a structured design approach. looking
at the call to the module, the reader knows the inputs, and what is changed.
if you pass the context, the the module can add/delete/modifiy any value in
the collection. as most classes are statefull, with lots of sideeffect to
calling methods, limiting this is always good.

-- bruce (sqlwork.com)
 
It is not a good thing to use context in this case. Because, context
will lost once the session is over and it will put you in unexpected errors.

The right approach is to have calls to methods and passing the parameters.

-
Vadivel Kumar
http://vadivelk.net
 

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

Back
Top