Over 10 years of community discussion and knowledge are maintained here as a read-only archive.
class ApplicationVO{ public static var FILESYSTEM_ROOT="some_directory/"; public static var BASE_IMAGE_FILENAME="img_"; public static function getPath(filename:String):String { return FILESYSTEM_ROOT+BASE_IMAGE_FILENAME+filename; }}
class MyVO { public var blah:int = 0;}class MyProxy extends Proxy { private var _myVO:MyVO; private static var _instance:MyProxy; public function MyProxy() { _myVO = new MyVO; _instance = this; } public static function get instance():MyProxy { return _instance; } // at most expose the VO via a static in the proxy public static function get vo():MyVO { return _instance._myVO; }}
var cachedStageMediator:StageMediator
For performance reasons (games), it should be ok to at least cache the result of the facade get, right?
Again, for performance, there are always going to be Singleton Mediators/Proxies. For instance, the StageMediator in my system is responsible for emitting resize messages, and also contains our window/viewport system. It's general and won't be changed, certainly within the same project lifecycle, so it could make sense to expose a public static singleton accessor instance().
what do you typically build VOs for? i.e. Do you just build VOs for marshalling data around between the various MVC classes, or do AS3 programmers tend to use them in place of traditional data structures defined as classes?
Likewise, singleton VOs seem like they could be ok with static accessors/variables, especially given they aren't necessarily connected to an MVC Proxy.
Ok, point taken, and to be honest I do like the purity of the Facade as the only singleton.