Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » J2EE Pattern »

Re: Doubts on design patterns

Ben Hill

2004-04-28

Replies:

> -----Original Message-----
> From: Ram Kishore [mailto:ramkishore.pasupunoori@(protected)]
> Sent: 28 April 2004 05:52
> To: J2EEPATTERNS-INTEREST@(protected)
> Subject: Doubts on design patterns
>
>
> Hi all,
> I know design patterns are grouped into three types : Creational,
Structural, and Behavioral.
> But my questions are,
> 1) Why State pattern is listed as behavioral, when it clearly defines some
structure.

It's point is it's change in internal state - i.e. it's behaviour...

> 2) Why Proxy is listed as a Structural pattern when it clearly has
behavior.

A proxy pattern links two entities, therefore is structural.

> 3) what is criteria for determining if a new pattern should be considered
Structural or Behavioral?

The criteria is if the pattern is structural or behavioural. i.e. it becomes
part of a structure, or exhibits some behavioural attribute. The criteria is
defined really only for the Gang of Four (GoF) patterns. There is no reason
why each pattern catalogue can not have it's own categories. For example the
J2EE patterns catalogue (of which this is a mailing list) has "Presentation
Tier", "Business Tier", "Integration Tier" patterns. Similarly, there is no
real reason why you should define a category, only one of organisation for
humans.

> 4) what is main difference between Decorator and Chain Of Responsibility?

They are not really comparable as they are completely different - think; "the
difference between a banana and a melon". The Chain of Responsibility allows
you to use a bunch of objects to deal with a request only if the object is
responsible for the request. The Decorator allows you to add additional
functionality to an object dynamically.

You can always visit www.javacoder.net and see the GoF patterns
implementation there.

HTH

Ben


********************************************************************

This email may contain information which is privileged or confidential. If you are not the intended recipient of this email, please notify the sender immediately and delete it without reading, copying, storing, forwarding or disclosing its contents to any other person
Thank you

Check us out at http://www.btsyntegra.com

********************************************************************

====================================================================
Companion Site: http://www.corej2eepatterns.com
J2EE BluePrints: http://java.sun.com/blueprints/corej2eepatterns
List Archive: http://archives.java.sun.com/archives/j2eepatterns-interest.html
Unsubscribing: email "signoff J2EEPATTERNS-INTEREST" to listserv@(protected)
©2008 junlu.com - Jax Systems, LLC, U.S.A.