Local database reading edition
Advantage of singleton over static methods?
Reconstructed from database records, not a captured original forum layout. Dates and display names are retained as recorded; timezone and real-world identity are not inferred. Historical advice, contact details and offers are not current. Original markup is shown as inert text.
Forum index · Object Oriented Design
Opening post
Asha · 2001-02-15 12:49:32
I have seen singleton classes used in many places.But most of the programmers has the question of why can't not i use static methods ,what is the deal of using Singleton?
Here is my thought. The difference between using a singleton over a class with static methods boils down to effective object-oriented design. Singletons normally represent a cleaner approach. A class of static methods, unfortunately, breaks down to a simple list of functions.
You may ask, what's the problem with a list of functions?
With a list of functions you no longer perform object-oriented programming. In fact, your work easily devolves into a classic procedural program. Suddenly, objects no longer represent the focus of your program. You begin to fall into a data-centric programming mode. That is, instead of sending messages to objects that encapsulate state and behavior, you begin to call functions that act on data.
Asha Balasubramanyan
http://www.ammu.org
Source notes
MyCommunity/nandighosha.org.zip!/forum/tools/snitz_forums_2000.mdb
Table: FORUM_TOPICS + FORUM_REPLY · record IDs: 34, 20