Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
15 votes
4 answers
5k views

Singleton or instantiate everytime I use? [duplicate]

I use a class that just extracts data from one known object, and distributes it to other known objects. No persistent configuration or such is needed in that class instance. How should I decide ...
bebbi's user avatar
  • 361
38 votes
3 answers
75k views

When to use a Singleton and when to use a static class [duplicate]

I've searched about this here and on StackOverflow and found some differences between the two. But I'm still not sure in what cases one would prefer a Singleton, and in what cases one would choose to ...
Aviv Cohn's user avatar
  • 21.5k
-1 votes
1 answer
2k views

What is the difference between class level attributes, Class constants and singleton methods?

What the difference given they all exist 'once per class'. When should I use one over another, i.e. for what purpose? I use Ruby.
Michael Durrant's user avatar
12 votes
7 answers
17k views

What are the roles of singletons, abstract classes and interfaces?

I am studying OOP in C++ and, even though I am aware of the definitions of these 3 concepts, I cannot really realize when or how to use it. Let's use this class for the example: class Person{ ...
appoll's user avatar
  • 353