Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought


Over 10 years of community discussion and knowledge are maintained here as a read-only archive.

New discussions should be taken up in issues on the appropriate projects at https://github.com/PureMVC

Pages: [1]
Print
Author Topic: singletone pattern implementation - what for?  (Read 10117 times)
marek
Jr. Member
**
Posts: 14



View Profile WWW Email
« on: November 07, 2008, 05:33:32 »

I have just been thinking...
Why actually Singletone has been implemented. Just cant get this point. I sucessfully started using pureMVC but to be honest I believe that if I remove that pattern from the core of PureMVC It will not affect my apps.
I do understand that main role of singletone is to protect from multiple instances creation - but this is like implementing that for command that should be run only one time. Why anyone possibly wants to start another application facade...

I might be missing the point but could someone explain that for me please?
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #1 on: November 07, 2008, 06:00:14 »

This argument has been gone over and over here. Yes you could remove the singletons if you wanted to, just like you could disable the safety on a rifle. This is a framework and many people will use it. They may or may not us it as intended, so it was designed to operate properly no matter what. If you need to understand the general use for the Singleton pattern more I suggest a read of the excellent book 'Design Patterns: Elements of Reusable Software'.

And in MultiCore, you do want multiple concrete facades and so the pattern becomes Multiton instead of Singleton. Without this behavior, you would end up devising another actor to manage them all. But fortunately it was only a minor adjustment to normal framework usage (you pass the multiton key to getInstance).

Just to show it could be done, forum user TheFlashWizard stripped out the singletons. But since the framework is stable at this point with no changes planned, and all the existing body of knowledge, docs, demos and utilities support framework with Singletons, it can't be supported or endorsed.

-=Cliff>
Logged
marek
Jr. Member
**
Posts: 14



View Profile WWW Email
« Reply #2 on: November 07, 2008, 06:40:50 »

Thanks Cliff!

Makes sense and it is fair enough. Didn’t mean that it is incorrect but was wandering is it really necessary or it is just a proper behaviour. I am working with design patterns since some time however more I do more questions I have. For last couple of days I feel a bit like a lack of knowledge, therefore ‘Design Patterns: Elements of Reusable Software’ is already ordered.

Cheers and sorry if it was not appropriate question. Was trying to look for a answer on this forum but just couldn’t manage to do it so thought it is right place to ask.
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #3 on: November 07, 2008, 07:51:33 »

No problem, and certainly this is the place to ask. And its certainly not inappropriate to ask why something is the way it is.

-=Cliff>
Logged
marek
Jr. Member
**
Posts: 14



View Profile WWW Email
« Reply #4 on: November 07, 2008, 08:01:21 »

Cheers. I am spending more and more time on this formum and within documentation but still feel that need to learn. Whole pureMVC conception is what lot of people looking for but it is almost impossible to master technics within one week and more I understand more hungry I am :)
Logged
Joel Hooks
Courseware Beta
Sr. Member
***
Posts: 146


baby steps

 - 46288188  - passport@provinsal.com  - joeltuff
View Profile WWW Email
« Reply #5 on: November 07, 2008, 09:11:44 »

http://www.as3dp.com/

Actionscript 3 Design Patterns is an awesome text also. It isn't a replacement for the GoF book, which is THE foundation, but it is a nice supplement and puts it in context.
Logged

http://joelhooks.com - my ramblings about developing with actionscript and python using pureMVC and django respectively.
marek
Jr. Member
**
Posts: 14



View Profile WWW Email
« Reply #6 on: November 07, 2008, 09:44:37 »

Thanks. Looks interesting. Will have a look into it, however personaly recomended wikipedia as good start for newbies:
http://en.wikipedia.org/wiki/Design_pattern_(computer_science)

Logged
Pages: [1]
Print