After having written WebObjects systems in Objective-C and moving
to Java when Apple translated all of WO to Java, the thing I missed
most were Categories which allowed one to add methods to a class
without subclassing.
Categories provide three conveniences:
* they allow a team to partition a large class into category
files and each contribute only to their own category, yet all be
contributing to the underlying Class.
* they allow the user of a class in a library/framework to
supplement the methods in that class with new methods of his/her
own choosing
* they allow the user to override faulty methods in the existing
library with their own fixes.
Without categories, extensions to classes come in two forms,
subclasses and utility classes. I've never gotten used to, or
liked, the proliferation of utility classes, in which every method
is a class method, that came with the transition to Java.
Basically, this devolves back to procedural programming under the
label OO.
You can do this in Groovy. Groovy is a language implemented on top of
Java, with many powerful features. As a result it can run on any Java
VM and I have deployed Java web applications on OS X that use Groovy
to script/code web site back end logic.
Groovy supports, among many other things:
* Categories
* Closures
* Dynamic methods and properties (via the MetaClass / MOP - Meta
Object Protocol) that can be defined and modified at runtime
* Builders (for creating small domain-specific languages / easy
building of trees)
Regards,
Marc
~ ~ ~
Marc Palmer (email@hidden)
Consultant/Analyst
AnyWare Ltd.
http://www.anyware.co.uk/
_______________________________________________
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