Win a copy of Node.js Design Patterns: Design and implement production-grade Node.js applications using proven patterns and techniques this week in the Server-Side JavaScript and NodeJS forum!

Martin Spamer

Greenhorn
+ Follow
since Oct 12, 2005
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Martin Spamer

Originally posted by Pho Tek:
// the main thread then creates a FooImpl instance and stores in inside a



I would be interested to see how it does this. The code as presented will always return null for Foo.getInstance() and FooImpl.getInstance() ;


Originally posted by Pho Tek:
Is this a variant of the singleton pattern ? I find it a bit difficult to follow.



It would appear to an attempt to make an abstract singleton to use as base class.

Originally posted by Ilja Preuss:
(There is one pitfall, though: being proud about complexity. Be sure to be proud about simplicity instead.)



Agreed, The most elegant solution in software engineering is the simplest solution that meets the requirements. Raise the principle of a single responsibility to an art form.
The principle of a single responsibility drives both aspects; so each class implements a single responsibility AND each responsibility is entirely encapsulated by a single class.

Originally posted by D Smith:
Can "Time" be an actor because system does something in response to a time event?
Thanks.



There is no problem with the concept but Time is not a good name for the actor. Look at whatever is generating those events and use the proper name of that. e.g. System Clock etc.