[Bluej-discuss] style question: best way to handle global data
Aryeh M. Friedman
aryeh.friedman at gmail.com
Fri Dec 7 00:00:46 GMT 2007
Chuck Iverson wrote:
> How about putting your constant config data in an interface and
> implementing it where you need it?
>
Don't you mean an abstract class instead of an interface?
> On Dec 6, 2007, at 12:51 PM, Aryeh M. Friedman wrote:
>
>
>> Let's say I have a global piece of data (like system wide configs) and
>> need to make it aviable in a number of unpredictable situations (i.e.
>> the caller does not necessarly know that global data will be used)....
>> for example if I am writing a replacement for JUnit and have a setting
>> for say the type of test and an other for say the reporting format to
>> use for results... what is the best way to handle this... I can think
>> two solutions use a Singleton (i.e. a class that has a static instance
>> of itself and uses that static instance for all method calls) and the
>> other is to pass the global data as a param... the con of the 1st is
>> it
>> violates the spirit of the no global data precept of OO and the draw
>> back of the second is the caller needs to be (unnecessarily) aware of
>> the fact that a called method will need global data.
>>
>> --
>> Aryeh M. Friedman
>> FloSoft Systems
>> Developer, not business, friendly
>> http://www.flosoft-systems.com
>>
>> _______________________________________________
>> mailing list bluej-discuss at bluej.org
>> To unsubscribe or change your preferences, go to
>> http://lists.bluej.org/mailman/listinfo/bluej-discuss
>>
>
> _______________________________________________
> mailing list bluej-discuss at bluej.org
> To unsubscribe or change your preferences, go to
> http://lists.bluej.org/mailman/listinfo/bluej-discuss
>
>
--
Aryeh M. Friedman
FloSoft Systems
Developer, not business, friendly
http://www.flosoft-systems.com
More information about the bluej-discuss
mailing list