I think you could be spot on here Aaron.

There are several difficulties with implementing the typesafe enum 
pattern in CF exactly as it us usually seen in Java.

The first problem is that in the Java world the constructor is declared 
as private so you can't create an instance of the class. You can't do 
that in CF.

Second problem is that the variables are declared as static final, so 
you can't change them except in the constructor of the class that 
declares them. Again, you can't really do that in CF.

Also, in the Java world, a common use of the pattern is to ensure that 
the value passed as a parameter can contain only one of a set of 
pre-defined values. The common example given is a class called Suit that 
has 4 fields. One for each suit in a pack of cards. You can then know 
that when you declare the argument to a function as being of type Suit 
that it must be one of the 4 permitted suits and anything else will fail 
*at compile time* not at runtime.

That may or may not be a requirement for what Taco is doing, but if it 
was, it would affect the implementation in CF.

The other thing about enums is that there are so many ways you could 
possibly use them that it's very difficult to say whether an 
implementation is a good one without knowing more about the specific 
scenario.

Spike

Aaron DC wrote:
> Sounds like Taco is reading and learning about patterns and trying to
> implement / translate them into CF purely for the exercise or sake of doing
> so. Hence he would like to discuss the implementation / code at a purely
> theoretical point of view, rather than a specific implementation point of
> view. Respondents to date seem to indicate that a pattern is basically
> useless without the associated problem it was intended to solve being
> present.
> 
> In a brain-storm session, Stage 1 is "every idea is good" - I think this is
> the space Taco is occupying. Once all the ideas are written down, Stage 2
> involves "picking the best / most doable" ideas - looks to me like this is
> the space occupied by his respondents.
> 
> I think the pattern porting exercise would be interesting and potentially
> valuable. This value could be greatly enhanced if a common CF or web-based
> programming scenario was also invented, for which the pattern provides a
> solution. Without this scenario, it would be like Mach-II or FB3/4 having
> base code and documentation, but no example apps.
> 
> My gut feeling is that there are only a handful of other developers here who
> would be able to discuss pattern templates or implementations. It may be
> that another list is better suited, or a new "CF-patterns" / "CF-hardcore"
> list would at least show you through its subscription how many others are
> interested.
> 
> Good luck, Taco, I hope you find others that share your passion.
> 
> Aaron
> 
> ----- Original Message -----
> From: "Spike" <[EMAIL PROTECTED]>
> To: "CF-Talk" <[email protected]>
> Sent: Tuesday, January 04, 2005 12:59 PM
> Subject: Re: Typesafe enum design pattern (another go)
> 
> 
> 
>>That's pretty much all we can discuss unless you lay out the problem
>>that you're trying to solve.
> 
> 
> 
> 
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Special thanks to the CF Community Suite Silver Sponsor - RUWebby
http://www.ruwebby.com

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:189206
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to