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. JavaGeeks.com: Does Sun own Java or only the Java(tm) Language, he discusses Sun's challenges to the name of the JavaGeeks.com 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="http://www-106.ibm.com/developerworks/xml/library/x-custyp/">
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="http://www.artima.com/forums/flat.jsp?forum=106&thread=81895">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
Communities
, the href="http://community.java.net/java-enterprise/">Java Enterprise
Community's home page links to Satya Komatineni's notes on href="http://weblogs.java.net/blog/satyak/archive/2004/11/
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="http://wiki.java.net/bin/view/Javapedia">JavaPedia is the page
devoted to
Patterns
. 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="http://forums.java.net/jive/thread.jspa?messageID=7242&tstart=0#7242">a perspective
on primitive and objects in today's href="http://forums.java.net/jive/index.jspa"> 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
treating
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
memory."


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
:

  • December 6-9, 2004 href="http://www.theserverside.com/architecture_workshop/index.html">
    TheServerSide Enterprise Java Architecture Workshop
  • December 7-8, 2004 href="http://jini.org/meetings/eighth">Eighth Jini Community
    Meeting
  • December 13-17, 2004 href="http://wiki.javapolis.com/">JavaPolis, 2004

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 href="http://today.java.net/pub/q/java_today_rss?x-ver=1.0">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.


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

One aspect beats a hundred pastes