So .. I do not understand why I should use singleton patterns in Action Script 3. Can anyone explain this to me? Maybe I could not understand the purpose of this. I mean how is it different from other patterns? how it works? I checked the pure MVC source and it is filled with singletons. Why are they using in View, Module, Controller?
I have no practical experience PureMVC so I can not debate them with singletons or use them . Therefore, I will try to keep my answer more normal.
A single object is a type of object that can only be instated once and is accessible globally.
Generally, patterns are used to gain access to any type of services in such a way, possibly a service mask that is used to obtain data from a server or any such Episode model that keeps information about settings or such information.
Singleton Patterns Many people are considered to be an anti-pattern for many reasons, some of which have been mentioned below:
- They take the state, some Works like unit testing is almost impossible.
- They naturally violate the single liability principle.
- Because they are globally accessible, they promote tight coupling between classes.
Why can I have a singleton an anti pattern for all the reasons, there are so many in it.
Comments
Post a Comment