Home  /  Questions  /  Question



50   50
Nov 11, 2010


Protecting the "proxy" of a webService

hiya,

We're using a 3rd party webService, I don't want the webService proxy set anywhere other than in the constructor.
I was thinking of creating a proxy class that simplycontains all the required properties...which will be set in theconstructor...

I've been reading up on sealed modifiers and singletons..I waswondering if the proxy is a candiadate for this approach?

Any advice appreciated.

ta,

yogi



830   99.9
Dec 03, 2010
Yogi:

Actually sealed modifiers, singletons, and constructors that initialize a series of private variables are all concepts that solve different problems. 

If you don't want others to access private variables then your constructor idea seems fine. If you don't want any other class to derive from your class, then the sealed modifier is fine. If you want just one instance of your class then the Singleton pattern works great.

So, the answer to your question really depends on what the problem is you're trying to solve.

Hope this helps.