Honestly Wagner, until you program in Objective-C for a while, it's
not possible to realize the true difference. Using categories in the
way I described is far easier to implement than the visitor pattern.
On Aug 25, 2006, at 3:03 PM, Wagner Truppel wrote:
Please forgive my ignorance; I don't know what those Qualifier
classes are but from what you described, it seems to me like you
were implementing something like the Visitor design pattern <http://
en.wikipedia.org/wiki/Visitor_pattern>. If that's the case, you
don't need to subclass every object in the entire structure.
Wagner
I, too, lament the passing of categories. For me, the most
important reason is recursion.
In Objective-C, it was extremely elegant to use categories to
augment classes that could possibly be in a hierarchical
structure. An example I often use is the *Qualifier classes. In
Objective-C, if I wanted to augment qualifiers to do something
special (today, I have a method "qualifierLimitedToRelationship
that pares down the qualifier to just one section), I could add a
category on each type of qualifier (including the abstract
EOQualifier) so I could ask the new question of any type of
EOQualifier. Because it was likely that qualifiers were stacked in
a hierarchy, implementing a method on EOAndQualifier and
EOOrQualifier that iterated over all its qualifiers and returned
an aggregate answer was easy. With Java, I have to subclass every
object in the entire structure, AND if someone else's code passes
me a qualifier tree that is not my custom subclass, I have to go
through the entire hierarchy and re-create my subclass. YUCK!
I miss categories...
Ken
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden