Skip to main content

A DRY wit

Posted by editor on December 2, 2004 at 12:25 PM PST

One aspect beats a hundred pastes

The first time I edited a piece on aspect-oriented progamming (AOP, also
known as AOD for "aspect-oriented development"), I couldn't see past the logging
examples and think of uses for AOP other than inserting new code into
already-deployed instances. And while that's great, there's more to the
concept, as Monika Krug writes in her first blog entry AOD and DRY.

DRY, in this case, means "don't repeat yourself", something that's often
hard to do for small blocks of code that aren't suited to being their
own methods, and hard to avoid when you've got that nice, friendly paste
command on your menu bar. Her example shows a potentially much-repeated
block of code for working through a possibly-empty Collection, and how an
AspectJ aspect can eliminate the duplicate special-case blocks in not only the
classes she's presented, but in any similar classes that might be developed
in the future.

Also in weblogs, Andreas Schaefer expresses his concern about how Sun defends the Java trademark. In Sun vs. Does Sun own Java or only the Java(tm) Language, he discusses Sun's challenges to the name of the website, saying " I was completely shocked that Sun is challenging this domain name especially because many other websites are using Java in their name"

Editor's Note: Chris Adamson is authoring this daily editor's blog for this first week of December. Daniel is very grateful.

In Also in
Java Today
, Elliotte Rusty Harold notes that instead of
focusing on the ease that RELAX NG brings to tasks that can be
accomplished using W3C Schema Language, you should look at the things
that RELAX can do more. In href="">
RELAX NG with custom database libraries Harold writes "RELAX NG is
not limited to one preordained collection of primitive data types with a
limited set of facets for extension. RELAX NG enables developers to
define custom type libraries that can assert any constraints a program
can verify."

Michael Feathers says that passing nulls takes him back to warnings by
his high school math teacher of the dangers of dividing by zero. In href="">When
Nulls Aren't Nasty, he explains that he passes in nulls all the
time. He does it in test code not production code and gives examples of
how and why.

In Projects and
, the href="">Java Enterprise
Community's home page links to Satya Komatineni's notes on href="
some_notes_on_l_1.html"> localizing server side applications. "Items
include managing two locales for your server side applications: one for
language and one for formatting."

One of the richest pages in the href="">JavaPedia is the page
devoted to
. A recent post to the discussion suggests you "refactor
toward that pattern or away from it depending on whether the pattern's
consequences, strengths, and trade-offs are appropiate for the program."

Continuing with the debate of whether to make switch() and case
work with any object or primitive, Monika Krug weighs in with href="">a perspective
on primitive and objects in today's href=""> Forums.
"I think not everything needs to be an object. Primitive data types, if
structures, loops, methods should be just that, not be forced into being
objects. 'Almost everything is an object' as in Java is great,
'absolutely everything is an object' as in Smalltalk makes the language
unnecessarily complicated."

murphee disagrees with some ideas regarding
functions and methods as first class objects
"I think learning several completely different languages (Java:
OOP,managed memory; C: structured programming, own memory management;
SML: functional, managed memory;,...) is a benefit. It's a nuisance at
first, but it broadens your view. At my University (TU Graz) we did
exactly that (we got taught: C, SML, Java in that order), and this gives
you the best of all worlds. BTW *only* learning Java is not a good idea;
students should be exposed to manual memory management at least once in
their life, so they can actually see the advantages of managed

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

  • December 6-9, 2004 href="">
    TheServerSide Enterprise Java Architecture Workshop
  • December 7-8, 2004 href="">Eighth Jini Community
  • December 13-17, 2004 href="">JavaPolis, 2004

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 href="">Java
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="">

Note: today's daily blog was written by Chris Adamson (invalidname), Associate Online Editor for

One aspect beats a hundred pastes