| Home | Tutorials | Forums | Articles | Blogs | Movies | Library | Employment | Press | Buy templates |
|
|
#1 |
|
rather be programming
Join Date: Feb 2005
Location: City of Angels
Posts: 10,000
|
Hi guys,
Is this a violation of the Hollywood Principle? ActionScript Code:
If not, I'm confused what it really means then.
__________________
I'm old enough to know better and young enough to do it anyway. -- maskedman |
|
|
|
|
|
#2 |
|
lala
Join Date: Feb 2002
Location: on the road
Posts: 2,859
|
this is composition. so in that sense not a problem for the hollywood principle.
the hollywood principle's best indications are template or startegy patterns and it asks you not to call up the chain |
|
|
|
|
|
|
|
|
#3 |
|
rather be programming
Join Date: Feb 2005
Location: City of Angels
Posts: 10,000
|
hm....you mean chain calling how how the Decorator Pattern does?
Think you could give me an example of what you mean?
__________________
I'm old enough to know better and young enough to do it anyway. -- maskedman |
|
|
|
|
|
#4 |
|
lala
Join Date: Feb 2002
Location: on the road
Posts: 2,859
|
you could call it a decorator, but in this exact example you are not adding more functionality to a method of the same name and adding some to it.
here i just see a class composed onto the class you wish to use and you taking functionality from that composed class |
|
|
|
|
|
#5 |
|
rather be programming
Join Date: Feb 2005
Location: City of Angels
Posts: 10,000
|
I don't follow. How do I break the Hollywood Principle?
__________________
I'm old enough to know better and young enough to do it anyway. -- maskedman |
|
|
|
|
|
#6 |
|
lala
Join Date: Feb 2002
Location: on the road
Posts: 2,859
|
you don't. the problems i see relates to the fact that you aren't coding to an interface
|
|
|
|
|
|
#7 |
|
rather be programming
Join Date: Feb 2005
Location: City of Angels
Posts: 10,000
|
LoL.....I'm not asking for feedback on what I wrote. I'm asking for someone to demonstrate breaking the Hollywood Principle. I don't understand what it is, so I'd like to see the anti-principle in action and then maybe the correct way.
__________________
I'm old enough to know better and young enough to do it anyway. -- maskedman |
|
|
|
|
|
#8 |
|
rather be programming
Join Date: Feb 2005
Location: City of Angels
Posts: 10,000
|
Can anyone show me the correct way of the Hollywood Principle and then the wrong way of it?
__________________
I'm old enough to know better and young enough to do it anyway. -- maskedman |
|
|
|
|
|
#9 |
|
as[org].addListener(this)
Join Date: Dec 2005
Location: LA, California
Posts: 838
|
Which one's the hollywood principle? Know only your friends?
I never hear the names of those principles outside of that java book. If so, then an example of that violation is: ActionScript Code:
Of course, nobody really cares about that one, since it would be far too inconvenient to do anything else. The idea is, that instead of talking to an object's sub-objects directly, you talk to them via the object as proxy. This way you abstract the implementation, so you can make changes in the future without breaking everything. For example, what if, for some obscure reason, Adobe decides to change the graphics property to "gfx"? Then the example listed above would break all over the place. However, if instead, your myShape had a public method: ActionScript Code:
Then you can just call that method instead. If graphics is changed to gfx, then the only place you have to make that change is inside that method...as opposed to a potentially infinite number of places. |
|
|
|
|
|
#10 |
|
rather be programming
Join Date: Feb 2005
Location: City of Angels
Posts: 10,000
|
Ah....that makes total sense. **light bulb goes off** And in fact, it is kind of similar to an adapter or command principles.
According to the book (which I don't have any more) the Hollywood Principle states "Don't call us; we'll call you." EDIT: Hmm....here it is at WIKIPEDIA. It seems like composed objects should not call methods on the client.
__________________
I'm old enough to know better and young enough to do it anyway. -- maskedman Last edited by Flash Gordon; 09-27-2007 at 06:38 PM.. |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Strong Flash Designer, Hollywood, CA | OSS | Projects and Positions | 0 | 05-15-2006 09:38 PM |
| Josh Davis Creative workshop /Toronto and Hollywood | pucknell | General Chat | 0 | 07-15-2005 07:14 PM |