View Full Version : Poltergeist? Gypsy Wagon?
maskedMan
09-19-2008, 07:44 PM
http://en.wikipedia.org/wiki/Poltergeist_(computer_science)
Correct me if I'm mistaken, but isn't this anti-pattern article describing the very practice of Event Dispatching that is inherent in AS3? I thought this article looked fishy even before I got into AS3 (and before the warning markers at the top happened to appear), but didn't really know why.
Assertnfailure
09-24-2008, 01:26 AM
a poltergeist (or gypsy wagon) is a short-lived, typically stateless object used to perform initialization or to invoke methods in another, more permanent class.
Events don't do anything like this...
Event dispatching isn't an antipattern, it's pretty closely tied to the observer pattern (http://en.wikipedia.org/wiki/Observer_pattern), which is a very commonly used pattern in OOP architecture.
maskedMan
09-24-2008, 03:42 AM
Oh, I'm aware that the event model in AS3 is related to the Observer pattern, and is not an anti-pattern. That's why I wondered what this article was talking about. My CS experience only ranges as far as Actionscript and the books on software development that I have read, so perhaps the finer points of distinction between Event objects and Poltergeist is lost on me. What is an example of a short-lived, stateless object that does these things?
Thinking about it, the EventDispatcher is not short lived, and it is what invokes the functions, passing the event object (which is short-lived) to the invoked function.
Assertnfailure
09-24-2008, 07:43 PM
Hmm....I guess I'd need an example of it. It's kinda vague.
Flash Gordon
11-12-2008, 09:47 AM
i see what you are saying but here is the difference:
is a short-lived, typically stateless object used to perform initialization or to invoke methods in another
You are thinking the Event is the "short-lived" object, and yes it is. However, the Event object is not what invokes other methods. It is a data object pushed to the invoked method. Small difference and easy to oversee, but what makes all the difference. The invoker is registered method in the EventDispatcher collection. A not so "short-lived" object.
hope that helps. cheers :)
pj-co
11-15-2008, 01:45 AM
Almost sounds like a decorator/proxy/adapter pattern too. Not sure I really agree with that article either.
|
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.