Does “Property” in C# cost much?
I have a class created in some namespace, like SomeNameSpace.SubNameSpace.StaticClassName
Template rendering engine legitimate use of a singleton?
I wrote a standalone singleton class (scaffold) tonight that serves as a facade to a few other classes, including a template class and a view class. Templates and views are both named and instances of each are stored in the scaffold object. Templates can contain views and views can contain other views. A template and it’s contained views is rendered when:
Name for Osherove’s modified singleton pattern?
I’m pretty well sold on the “singletons are evil” line of thought. Nevertheless, there are limited occurrences when you want to limit the creation of an object. Roy Osherove advises,
null values vs “empty” singleton for optional fields
First of all I’m developing a parser for an XML-based format for 3D graphics called XGL.
But this question can be applied to any situation when you have fields in your class that are optional i.e. the value of this field can be missing.
should singleton be life-time available or should it be destroyable?
Should the singleton be designed so that it can be created and destroyed at any time in program or should it be created so that it is available in life-time of program. Which one is best practice? What are the advantages and disadvantages of both?
EDIT :- As per the link shared by Mat, the singleton should be static. But then what are the disadvantages of making it destroyable? One advantage is it memory can be saved when it is not useful.
What are the downsides of implementing a singleton with Java’s enum?
Traditionally, a singleton is usually implemented as
How to create a manager class without global variables nor singletons?
I would like to implement some kind of manager class in my application. It will be in charge of loading textures, processing them, distributing them etc…
Are immutable/stateless singletons bad?
Lately there have been some kind of revolution against singletons, but is there something wrong with them if they are stateless?
How to get a reference to a central AssetLoader in every Widget?
I’m working on a simple UI system for a game. The building blocks are Widget
objects, which can contain each other. There are several sub classes of Widget
, e.g. LabelWidget
, ImageWidget
and ButtonWidget
.
Why don’t we use a class and its static members to do what a singleton does?
In Java,C++,Objective C, C#, and all other similar OOP languages,