Posted by daniel
on June 1, 2005 at 6:56 AM PDT
Revisiting C. . . also
Weblogs: Fit, Synth, and Gosling in Madrid
Also in Java Today: AWT grows up and part 2 of developing for the web with Ant
Projects and Communities Jini community webinar and JUGs Wiki
Forum posts: Java in game platforms and safer switch statements
I've spent the past week working on some sample code in C and Objective-C for a book on Bonjour (formerly Rendezvous) I'm co-authoring with Stuart Cheshire. When I first came to Java, the guys with the Smalltalk roots were stressing that a method call should feel like making a request of an object and not like a function call from C.
This means, for example, if I have some bunch of data that I want to do something to, I would probably first have an object that encapsulates that data and contains the name of the methods that know how to operate on that data. I then would have some instance variable that can point to the results. In Java that looks something like:
SomeType myType = anObject.doSomething(param1, param2);
I'd forgotten that in C the same thing looks something like this:
someFunction(inputDataStruct, outputLocation, param1, pararm2);
You know when you go to another country where they speak a language you haven't used in years? At first you translate everything back to your native language. But that is too jarring and too slow. So you then slowly start to think in the language of the country you are visiting. I'm not sure I can ever think natively in C again, but after a while the C way of doing things made sense in the middle of a C application.
Then it was time for Objective-C. It feels like a cross between the two paradigms. You don't write
anObject.doSomething(); you write
[anObject doSomething()]; After a very short time Obj-C code is very readable. Writing it required having friends on IM who could answer my questions (thanks Rainer, Duncan, and Chris) but I had a ball. After each of these excursions I feel as if my understanding of Java is also deepened. There's nothing like visiting another land to help you look at your own with new eyes.
I used a debugger this weekend for the first time in over two years. I was serializing an object, sending it over the wire, and deserializing it and the results were puzzling. The IM hint from Rainer was, use the debugger to examine the object before and after deserialization. It worked like a charm and (with his permission) I now have a Bonjour demo version of Ken Arnold's Jini mood ring.
In Java, TDD has kept me out of the debugger between Fitnesse and Junit. In today's Weblogs Bill Wake provides his Fit Reading (1 of n) .
"'Fit' is Ward Cunningham's 'Framework for Integrated Tests'. I've used it for a while, and looked at some of its code along the way, but hadn't sat down and really studied it systematically. My plan is to spend an hour at a time, just digging in to what I find and sharing my notes."
Romain Guy's debut blog is an appeal that Synth needs you! "Synth is great but not perfect, so help us! The problem is we will soon reach a feature freeze state and I won't be able to easily introduce changes in the public API."
James Gosling is back on the road. He writes "I'm in Madrid for a couple of days to participate in their JavaExpo. I spent a couple of hours yesterday with a bunch of customer service engineers who where telling me about what's happening here in Spain."
In Also in
Java Today ,
the Abstract Window Toolkit is still gaining new capabilities with each J2SE release, and John Zukowski's Taming Tiger: AWT grows up discusses some of the AWT improvements in J2SE 5.0: "these include
MouseInfo for recovering pointer position and z-order management for screens with overlaid components. "
Ant is great at building and packaging your web application code, but did you know that it can deploy your app as well? In Developing for the Web with Ant, Part 2 , Steve Holzner shows how to use ant to copy files to their deployment directories (local or remote) and how to deploy to Tomcat and EJB containers. This excerpt from Ant: The Definitive Guide, 2nd Edition also shows how ant can compile your JSPs for faster startup and for deployment to servers that don't have the full JDK available.
In Projects and
Communities , the next Jini Community webinar , "Integrating and Migrating Legacy Services Using the IP Surrogate Architecture," will be held June 15 at noon EDT (16:00 UTC). In it, Jools Enticknap will discuss "experiences learned from integrating c/c++ legacy applications into a Jini based SOA."
Java User Groups can enjoy wiki-style collaboration at the JUGs Wiki , in which you can add your JUG and build out community-editable content in a familiar wiki way. JUGs that have recently added pages to the Wiki include JavaUserGroupMilano and JavaSherbrooke .
So Is Java going to move into the Game Platform environments (PS, XBox, GC) ?
In today's Forums ,
javakiddy writes, "the new generation of consoles are network enabled as standard, and the current 'buzz phrase' pushed by manufacturers is 'user created content'. Obviously this means music and other digital media - but for games this can also mean user created levels and characters, etc. So why not user created games, downloadable from a central on-line resource?"
cowwoc would like to see Safer switch statements . "I propose modifying switch() such that if no "default" case is specified the compiler will automatically generate a catch-all statement that throws IllegalArgumentException with "Unexpected value ". You'd retain backwards binary compatibility (since nothing changes in the bytecode). Only new compiled code would be affected."
In today's java.net
News Headlines :
Registered users can submit news items for the
href="http://today.java.net/today/news/">java.net News Page using our
form . All submissions go through an editorial review before being
posted to the site. You can also subscribe to the
href="http://today.java.net/pub/q/news_rss?x-ver=1.0">java.net News RSS
Current and upcoming Java
Registered users can submit event listings for the
href="http://www.java.net/events">java.net Events Page using our
href="http://today.java.net/cs/user/create/e"> events submission form.
All submissions go through an editorial review before being posted to the
Archives and Subscriptions: This blog is delivered weekdays as
Today RSS feed . Also, once this page is no longer featured as the
front page of java.net it will be
archived along with other past issues in the