Skip to main content

Middle of the Code

Posted by editor on July 25, 2006 at 7:01 AM PDT


Internationalization as a cross-cutting concern

I initially had some questions about the premise of today's feature article, which advocates using Aspect-Oriented Programming to provide Internationalization features. After all, the Java language already has good support for I18N through its use of Unicode, the Locale-oriented scheme for finding and loading ResourceBundles, and the various text formatting classes of java.text. Why not just use those in the first place and not have to engage the inherent craziness of AOP?

Of course, I could have answered my own question. The reason we don't use those from day one is that we just don't. We throw down code for early spike solutions without worrying about niceties like internationalization, burn through another round of VC, and before you know it, there's 50,000 lines of source with hard-coded Strings for everything. On two occasions, with two different employers, I headed up efforts to I18N an existing code base that was already large and getting larger -- both times, we forked the code and put a couple weeks' work identifying all the places that needed I18N and changing them, usually using a "pig latin" localization to test that the I18N worked and was complete (I don't know who came up with that approach, but it's awesome). And when we were done, the trunk had evolved so much that in both cases, management thanked us for doing the I18N work and proceeded to throw it away.

The problem was that we decided we had to fork to put together a working I18N version, and this effort was less valuable than the ongoing non-I18N work on the trunk and the time it would take to merge the two. Yes, you can see a lot of bad development and management pracices in these scenarios. All I can say is that it was the 90's, with all the attendant boom-era pathologies of those times. But in any case, the only way this could have worked under these conditions would be to lay in the I18N without in any way disturbing the feature-fest that was the trunk development.

This speaks to a concept that Stephen B. Morris addresses in today's article, an idea he calls "low-touch programming" (LTP):

With LTP, which is just good design practice, you add or modify code in a manner that's as non-invasive as possible. Ideally, LTP should allow you to drop working classes into an operational product. The dropped-in classes then provide any required extra capabilities and help fulfill at least the first two requirements listed earlier ["low cost" and "flexible solutions"]. AOP is an unusual technology that can facilitate such class insertion and other LTP needs.

In the Feature Article, Aspect Oriented Programming and Internationalization, Stephen takes an AOP approach to providing I18N to an existing codebase, showing how to add in support for variant currency and date/time displays, without touching the existing code. Take a look at it, and think about whether this approach would work for you on large-scale, un-I18N'ed code-bases.


In Java Today,
the revised jini.org is back online, featuring a round-up of information related to Jini, including links to the specifications, downloads, and the starter kit API. The site no longer hosts projects, many of which have moved to a new home on java.net. A complete explanation of what's where can be found in the note What happened to Jini.org?

Elliotte Rusty Harold, author of Java Network Programming and Java I/O, as well as the Amateur Java media player/editor, takes a look at performance challenges in How to write network backup software: a lesson in practical optimization. "Pulling operations outside of loops or reducing the number of operations in a method rarely has any noticeable effect on performance. Most real performance problems come from doing too many fundamentally slow operations; for instance, writing to the disk or reading from the network."

JavaServer Faces technology is great for encapsulating a component's artifacts, which hides complexity from the end user. In the quest to create reusable components, the developer has to make trade-offs between complexity and reusability. When designing components, developers find that most development projects require the repetition of common tasks. One function that is commonly required is accessing static and dynamic resources. In the article Accessing Resources From JavaServer Faces Custom Components, Mark Basler looks at how to handle requests for static and dynamic resources.


David Van Couvering casts his net wide in today's Weblogs with a blog on
Working from home, OSCON, AJAX, Groovy and global warming:
"How's that for a single blog going all over the map? I'm here at OSCON and use about the glory of working from home, and talk about what I've been learning and thinking about from the tutorials I've taken so far."

java.net intern Sonya Barry reports that she's still
Slogging away:
"It is 10:30 pm and still over 90 degrees in my apartment. I make no guarantees about the quality of this post."

Got some time to watch Simon Morris do a little
Swing Magic?
"There's nothing up my sleeve. At no time do my hands leave my wrists. We've never met before, have we? -- It's time for some minor Swing magic!"


In today's Forums,
dmouse is looking for programmatic options for
Cancelling Drag and Drop:
"I noticed that when I enabled D&D on a JTable and drag and drop something outside of the table my dragDropEnd() method is called but I don't seem to have a way to stop the drag operation. If I drop on the table, which is registered as a drop target, I can indicate that the drag was successful or not in the drop() method. Assuming I don't want to cancel the D&D operation in dragExit what is the correct way to cancel drag and drop if my DropTargetListener drop() method is never called?"

Boldly going where thousands of Java developers have seemingly already gone, sajalmalhotra could use a lot of help getting started with the
Development of an IDE with GUI Designer:
"We want to develop an IDE in java, which will provide a GUI Designer also. GUI designer will allow to Design some screens by providing some minimum controls( developed in Java Beans). The output files fed to compiler would be XML files. Could anyone tell me how to start of a development of your own IDE like this. Any books or material available, which tells how to develop such IDEs or GUI Designers. Actually i have experience in VC++ but not java. So i am sort of beginer in JAVA. I would be greatfull if someone can extend some help."


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
news submission
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
feed.


Current and upcoming Java
Events
:

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
site.


Archives and Subscriptions: This blog is delivered weekdays as
the Java
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 href="http://today.java.net/today/archive/">java.net Archive.

Internationalization as a cross-cutting concern