« Turn the Page, Revisited: An Updated Book Component for JavaFX | Main | JavaFX Tips and Tricks: Invoking JavaFX Functions from Java »

April 06, 2009

TrackBack

TrackBack URL for this entry:
http://www.typepad.com/services/trackback/6a00e54f133d69883401156efa6fac970c

Listed below are links to weblogs that reference JavaFX Tips and Tricks: Using Singleton Pattern to Share a Model:

Comments

Rémi


Hi Jim,

I am a big fan of design patterns and transmit my enthusiasm to my students.
MVC is a wonderful architecture but I usually warn my students about the singleton pattern.
I would recommend passing the model as a parameter to each view instead of using a singleton pattern.

Singleton is good for the problem it solves (implementing global variables) but is often overused as it is easy to explain and understand.
Singleton causes many unnecessary dependencies and maintenance nightmares.

In your example, when you will want to have two models in your application, your views won't be able to cope with this new setup.

Interested readers can do a google search on evil singleton:
http://www.google.com/search?hl=en&q=evil+singleton

Thanks for your blog,

The comments to this entry are closed.