Interesting approach to the singleton pattern in Joshua Bloch's book 'Effective Java' 2nd edition.
public enum Singleton {
INSTANCE;
}
This simple idiom solves a lot of non-trivial problems, as synchronization or serialization. I do really like this approach -I had never thought about this option.
What about you?
Thursday, February 9, 2012
Subscribe to:
Posts (Atom)
State machines in JS
You can read in previous blog posts the reasoning behind state machines: they simplify and unify the way we define states and transitions i...
-
I just needed to refactor the finite state machine for java project that is available in https://github.com/xaviferro/xiron-statemachine ...
-
If you had used Optional in other languages, I implemented a very simple version for JS. Check tests for using it properly. Take a look a...