Current Context in Libraries

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
 
B

bruce barker \(sqlwork.com\)

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)
 
V

Vadivel Kumar

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

Members online

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top