Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 09-19-2008, 06:44 PM   #1
maskedMan
Obfuscated Coder
 
maskedMan's Avatar
 
Join Date: Apr 2008
Posts: 1,571
Default Poltergeist? Gypsy Wagon?

http://en.wikipedia.org/wiki/Polterg...mputer_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.
__________________
http://www.scriptocalypse.com - It's not the end of the world. It's just Actionscript!

man.mask = mask_mc;
maskedMan is offline   Reply With Quote
Old 09-24-2008, 12:26 AM   #2
Assertnfailure
as[org].addListener(this)
 
Assertnfailure's Avatar
 
Join Date: Dec 2005
Location: LA, California
Posts: 837
Default

Quote:
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, which is a very commonly used pattern in OOP architecture.
Assertnfailure is offline   Reply With Quote
Old 09-24-2008, 02:42 AM   #3
maskedMan
Obfuscated Coder
 
maskedMan's Avatar
 
Join Date: Apr 2008
Posts: 1,571
Default

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.
__________________
http://www.scriptocalypse.com - It's not the end of the world. It's just Actionscript!

man.mask = mask_mc;
maskedMan is offline   Reply With Quote
Old 09-24-2008, 06:43 PM   #4
Assertnfailure
as[org].addListener(this)
 
Assertnfailure's Avatar
 
Join Date: Dec 2005
Location: LA, California
Posts: 837
Default

Hmm....I guess I'd need an example of it. It's kinda vague.
Assertnfailure is offline   Reply With Quote
Old 11-12-2008, 08:47 AM   #5
Flash Gordon
rather be programming
 
Flash Gordon's Avatar
 
Join Date: Feb 2005
Location: City of Angels
Posts: 10,140
Default

i see what you are saying but here is the difference:
Quote:
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
__________________
trace("Good bye Flash.") Log.i(TAG, "Hello Droid");
Flash Gordon is offline   Reply With Quote
Old 11-15-2008, 12:45 AM   #6
pj-co
Site Contributor
 
pj-co's Avatar
 
Join Date: Jun 2008
Location: Brooklyn
Posts: 360
Default

Almost sounds like a decorator/proxy/adapter pattern too. Not sure I really agree with that article either.
pj-co is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 09:11 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.