Skip to main content

Tall Cafe Mocha to go

Posted by daniel on October 27, 2004 at 6:52 AM PDT

Cocoa for Java programmers

To a midwesterner used to the change of seasons, it doesn't really
feel like fall here at the Mac OS X conference in Santa Clara,
California. It's a fun conference with cool talks on Subversion,
automation, and plenty of coding tricks, techniques, and worthwhile
conventions. But there is not the change of colors, falling leaves, or
smell of fall that we get back home this time of year. It's the time
to sit in the back yard in front of a fire with a warm cup of
cocoa fortified by a shot of espresso.

Honestly, I wasn't even thinking of this until I went to Stu
Halloway's excellent talk yesterday on Cocoa for Java programmers. Of
course his talk had nothing to do with autumn in Cleveland. He
presented some of the gotchas for experienced Java programmers who
would like to program in Objective C using the Cocoa framework for
targetting Mac OS X development.

The first obvious difference is the syntax of swapping the dots
used to call methods in Java ( i.e.
) for nested square
brackets. He moved on to memory management issues and reflection. In
each case he was able to quickly explain a Cocoa concept by using Java
as a common frame of reference. There are enough Java programmers that
many books and presentations are beginning from the standpoint of
assuming you understand the Java programming language. In the early
years of Java, the reverse was true. You saw titles like Java for C
developers. We are now the establishment we once tried to overthrow.

In today's Weblogs,
John Reynold has responded to reader requests with href="">Tapestry
Component Examples: contrib:Tree and contrib:Table in which he
"created a suit of examples on how to use the Tapestry Tree
component. I've also added some new examples to the Tapestry Table
component suite."

In Also
in Java Today
, Eugene Kuleshov is exploring the ASM Bytecode
Toolkit, applying it to the metadata feature introduced in J2SE 5.0.
In href="">Create
and Read J2SE 5.0 Annotations with the ASM Bytecode Toolkit, he
shows how annotations are represented in Java bytecode, and how the
ASM bytecode-manipulation toolkit can work with them, even in pre-5.0
JVMs, noting that the article's code "allows you to read annotation
data that is not available through the Java 5 reflection API."

Brian Goetz most recent article on "Java theory and practice"
explains href=""> More
flexible, scalable locking in JDK 5.0 . He describes the new
locking model in Tiger and motivates the change by saying that
pre-Tiger "synchronization is good, but not perfect. It has some
functional limitations -- it is not possible to interrupt a thread
that is waiting to acquire a lock, nor is it possible to poll for a
lock or attempt to acquire a lock without being willing to wait
forever for it. Synchronization also requires that locks be released
in the same stack frame in which they were acquired, which most of the
time is the right thing (and interacts nicely with exception
handling), but a small number of cases exist where
non-block-structured locking can be a big win."

In Projects and
, the
Mac Java
community links to a MacDevcenter article by Mike
Butler on href="">
Making Cocoa-Java apps scriptable so AppleScripts can be used to
automate your Java applications on the Mac.

The Java Games
community features a forum on href="">J2ME
game development. Check out this thread on the challenges of
developing a href=";action=display;num=1094444057">
J2ME wordbuilding game.

Vikstar would like to " Allow passing of href="">
primitive types to generic declarations. There are many useful places
for this, one example is anyware where seperate methods have to be
created for each number primitive type."

Dog provides an example of how "the 'class' keyword would be very
useful. It is a common pattern to say something like:

final static Logger = new Logger(MyClass.class.getName());
copying around code it is often easy to miss the reference to the
MyClass class and end up logging in the wrong place. The 'class'
keyword would solve this."

In today's
, Monika Krug " would like a method in FileWriter
that adds the system-dependent linebreak character after the line: href="">
.writeln(String). As FileWriter inherits its write methods from
OutputStreamWriter and Writer, it should probably be defined in one of

In today's
News Headlines

Registered users can submit news items for the href=""> News Page
using our news
submission form
. All submissions go through an editorial
review before being posted to the site. You can also subscribe to
the href="">
News RSS feed.

Current and upcoming
Java Events

Registered users can submit event listings for the href=""> Events Page using our href=""> events submission
form. All submissions go through an editorial review before being
posted to the site.

Archives and Subscriptions: This blog is delivered
weekdays as the
Today RSS feed
. Also, once this page is no longer featured as the
front page of it will be
archived along with other past issues in the href=""> Archive.

Cocoa for Java programmers