The Artima Developer Community
Sponsored Link

singleton using static method

Advertisement

Advertisement

This page contains an archived post to the Design Forum (formerly called the Flexible Java Forum) made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.

Message:

singleton using static method

Posted by Ted on 24 Mar 1999, 1:48 PM

In an application I'm developing I have a singleton class
which provides basic services used throughout the application.
The singleton is implemented using statics. I do not believe
the question of object-oriented versus procedural programming
applies here. It is one of style.

For a singleton accessed in many places, ClassName.method()
seems to me to be more readable than
ClassName.getInstance().method. Since the concensus
is not to use statics for singletons I will probably change
it, but I am not completely convinced.




Replies:

Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us