Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Apple should get behind Cocoa Java




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)


http://groovy.codehaus.org

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

This email sent to email@hidden
References: 
 >Re: Re: Apple should get behind Cocoa Java (From: Wagner Truppel <email@hidden>)
 >Re: Apple should get behind Cocoa Java (From: "Jerry W. Walker" <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.