Singleton Pattern
Problem
Many times you only want one, and only one, instance of a class. For example, you may only need one class that creates server resources and you want to ensure that the one object can control those resources. Beware, however, because the singleton pattern can be easily abused to mimic unwanted global variables.
Solution
The publicly available class only contains the method to get the one true instance. The instance is kept within the closure of that public object and is always returned.
This works because CoffeeScript allows you to define executable statements inside a class definition. However, because most CoffeeScript compiles into a IIFE wrapper you do not have to place the private class inside the class definition if this style suits you. The later might be useful when developing modular code such as found in CommonJS (Node.js) or Require.js (See the discussion for an example).
Discussion
See in the above example how all instances are outputting from the same instance of the Singleton class. You can also see that the PrivateClass and instance variable are not accessible outside the Singleton class. In essence the Singleton class provides a static method get which returns only one instance of PrivateClass and only one. It also hides the PrivateClass from the world so that you can not create your own.
The idea of hiding or making private the inner workings is preference. Especially since by default CoffeeScript wraps the compiled code inside it’s own IIFE (closure) allowing you to define classes without worry that it might be accessible from outside the file. In this example, note that I am using the idiomatic module export feature to emphasize the publicly accessible portion of the module. (See this discussion for further explanation on exporting to the global namespace).
Note how incredibly simple coffeescript makes this design pattern. For reference and discussion on nice javascript implementations, check out Essential JavaScript Design Patterns For Beginners.