Talk:Trains design

From CSSEMediaWiki
(Difference between revisions)
Jump to: navigation, search
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
I'm not sure about the relationship between InactiveLoco and Locomotive. Is it bad design how a subclass contains another subclass of the same base class? I thought I had read something like this on the Wiki but couldn't find it. --[[User:Elliot Fisher|Elliot Fisher]] 09:31, 6 October 2008 (UTC)
 
I'm not sure about the relationship between InactiveLoco and Locomotive. Is it bad design how a subclass contains another subclass of the same base class? I thought I had read something like this on the Wiki but couldn't find it. --[[User:Elliot Fisher|Elliot Fisher]] 09:31, 6 October 2008 (UTC)
  
Hmm...now that you mentioned that. It's actually [[Proxy]] design pattern! =D --[[User:Johannes Pagwiwoko|Jojo]] 21:28, 7 October 2008 (UTC)
+
Hmm...now that you mentioned that. It's actually [[Proxy]] design pattern, I think? --[[User:Johannes Pagwiwoko|Jojo]] 21:28, 7 October 2008 (UTC)
 +
 
 +
:InactiveLoco is definitely an [[Adapter]] rather than a [[Proxy]].  A [[Proxy]] does not provide a different interface, it exists to transparently perform additional actions.  An [[Adapter]] on the other hand often does not perform any or many additional actions, it exits to provide an alternative interface and often simply passes messages on to the adaptee.  --[[User:Aidan Bebbington|Aidan]] 21:21, 4 October 2009 (UTC)

Latest revision as of 21:21, 4 October 2009

I'm not sure about the relationship between InactiveLoco and Locomotive. Is it bad design how a subclass contains another subclass of the same base class? I thought I had read something like this on the Wiki but couldn't find it. --Elliot Fisher 09:31, 6 October 2008 (UTC)

Hmm...now that you mentioned that. It's actually Proxy design pattern, I think? --Jojo 21:28, 7 October 2008 (UTC)

InactiveLoco is definitely an Adapter rather than a Proxy. A Proxy does not provide a different interface, it exists to transparently perform additional actions. An Adapter on the other hand often does not perform any or many additional actions, it exits to provide an alternative interface and often simply passes messages on to the adaptee. --Aidan 21:21, 4 October 2009 (UTC)
Personal tools