Skip to main content

Aspects

Posted by daniel on December 26, 2003 at 8:36 AM PST

Aspects seem like they're a good idea - I've just been waiting for an example that wasn't logging, debugging, or security.

The idea of cross-cutting concerns makes a lot of sense. There are some parts of a program that don't seem to belong in the hierarchy because they are used throughout the application. Two canonical examples seem to be logging and security. The ideas aren't new. The OOPSLA talks on HyperJ and AspectJ talks at OOPSLA over the years seemed to be well attended.

There seem to be three news pieces to the puzzle that are starting to spread this technology. First, implementations have gotten better. Although AspectJ seems to have the mindshare, there are other implementations such as AspectWerkz. Second, support for Aspect Oriented-Programming is now included in popular IDEs. AspectJ is part of the Eclipse project so there is, of course, support there. But my IDE of choice, Intellij's IDEA, has support for AOP in it's early access releases. Third, now that people have been playing with aspects for a while, you are starting to find more thoughtful articles and books. These include examples other than the three you've seen repeated.

Today we feature a book excerpt and a link to an article by the same author. Ramnivas Laddad wrote a book for Manning called "AspectJ in Action: Practical Aspect-Oriented Programming". We are featuring a pdf of the third chapter AspectJ: syntax basics. This is a good chapter to feature as it gets you deep enough into the "how to's" that you can start to play with the technology. The book is on my list of items to buy once the local bookstores are through with the post-Christmas returns and gift-certificate crowds.

We also feature Laddad in href="http://today.java.net/pub/q/alsotoday"> Also in Java
Today
with part two of his ServerSide series on Aspect-oriented refactoring. In this article he provides refactorings such as "Extract lazy initialization" and "Replace argument trickle by wormhole". He advises that you start by looking to use conventional refactorings but, when appropriate, reach for those that he lists. He also advises that the process will become easier once there is tool support for these refactorings as there is for more traditional techniques.

We also link to part two of a recent core Java Tech Tip for newbies called More on handling exceptions. This tip begins by looking at an error that was in one version of the code released in the previous month and highlighting what type of exception should be thrown and where. The last addition to the code is a resource clean up in the finally block.


In href="http://weblogs.java.net/">Weblogs , William Wake takes a look back at the important tools he's used this past year for Java development in an entry titled Tools - especially JUnit and Fit . I agree with him that Fit and JUnit were life changing tools for me that altered my programming cycle. His current IDE is IDEA and yet he writes that he plans to move towards Eclipse in the next year.

Michael Nascimento Santos shares an Ant build script with you in his Christmas post Building javadoc from J2SDK source code. Though he doesn't explicitly say so, it sounds as if Michael recently downloaded the J2SDK 1.5 beta and was disappointed to find that it didn't come with JavaDocs pre-built. Thanks Michael for making this easily modifiable script.

John Mitchell points to a recent blog of his that discusses Deconstructing the Cmabirgde Uinervtisy Rschereach Sramlcbe . There was a popular story earlier this year on how text remains readable no matter "waht oredr the ltteers in a wrod are, the olny iprmoetnt tihng is taht the frist and lsat ltteer be at the rghit pclae. The rset can be a toatl mses and you can sitll raed it wouthit porbelm. Tihs is bcuseae the huamn mnid deos not raed ervey lteter by istlef, but the wrod as a wlohe." There is more to the story than this, and it is an entertaining read.


In Projects and
Communities
, the Java Web Services and XML community is providing this week's project spotlight once again. This week it is the weekly JAXB drops available from the java.net project for the Java APIs for XML binding. The Java Tools community points to Erich Gamma's interview with OpenEnterpriseTrends on the four main directions for the summer 2004 release of Eclipse: "(1) Rich Client Platform -- moving beyond development tools, (2) UI Responsiveness -- running more operations in the background (3) Improved User Experience -- easier navigation/accessing features, and (4) Generalized Java tools -- handling more than just Java source files. "


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. Once this page is no longer featured as the front page of href="http://www.java.net"> java.net it will be archived at href="http://today.java.net/today/archive/index_12262003.html">
http://today.java.net/today/archive/index_12262003.html. You can
access other past issues in the href="http://today.java.net/today/archive/">java.net Archive.