My Photo

August 2007

Sun Mon Tue Wed Thu Fri Sat
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31  

November 15, 2006

Two Useful Aspects

Sometimes it's refreshing to write a useful little aspect. Just last night I was reviewing some code that colleagues wrote for thread safety and I found this to be a really efficient way to find likely danger spots:

public aspect TrackCollectionAccess {

    declare warning: set(java.util.Collection+ *.*) || get(java.util.Collection+ *.*): "collection field access";

    declare warning: set(java.util.Map+ *.*) || get(java.util.Map+ *.*): "map field access";

}

I was able to weave this into the project and quickly review places in the code where fields containing collections and maps were being used to see if they were used in a way that wasn't thread safe. This is a nice example of a development-time aspect: using them to help you develop without using them in production.

On the other extreme, I recently extended Glassbox to allow for various kinds of application-specific plugins. There are a number of points where plugins need to interact with the underlying system, and it turns out to be a good example of how you can use aspects to modularize a feature variation. For example, here is how the DefaultPluginManager aspect allows a plugin to define new kinds of operations:

    Object around() : getOperations() {

        Collection result = (Collection)proceed();

        for (Iterator it=operationPlugins.values().iterator(); it.hasNext();) {

            OperationPlugin plugin = (OperationPlugin)it.next();

            Collection added = plugin.getOperations();

            if (added != null) {

                for (Iterator inner=added.iterator(); it.hasNext();) {

                    OperationSummary summary = (OperationSummary)inner.next();

                    summary.getOperation().setPlugin(plugin);

                }

                result.addAll(added);

            }

        }

        return result;

    }

November 14, 2006

Learning About Aspects

I enjoyed being back at a couple of No Fluff Just Stuff conferences this fall (including the Rocky Mountain Software Symposium this past weekend). Jay Zimmerman continues to do a great job of providing fresh technical content with great speakers and it's always fun to talk the audiences at these about topics like Glassbox, AOP, and AJAX.

For those who are interested in digging in to aspects more deeply, I highly recommend the Aspect Leadership Program (ALP), which will be held in Vancouver this March 14th and 15th.

The ALP is an opportunity to learn from seven of the world's leading experts, who will provide a two-day crash course on everything you need to know to figure out what aspect-oriented programming (AOP) is all about; identify whether and how you can use it to add value, drive quality and improve productivity in your enterprise; and provide practical guidance on implementing AOP. I'm also proud to be part of the presenters at this event. Please pass on the word about this to others who might be interested, too!

October 25, 2006

AOP at the Colorado Software Summit

I'm enjoying another year of presenting at the Colorado Software Summit. One of my talks is about AOP with Spring 2.0, covering both the use of Spring AOP and of AspectJ within Spring. I've really enjoyed some of the dialog with attendees when I give this talk and afterwards: it's great to hear how people are making real use of AOP and new ideas for additional uses.

At one bank, they are using Spring AOP with Spring MVC to scan incoming Web requests for SQL injection attacks. In another department they are using AspectJ to implement use cases separately such as sending email notifcations after business events, supporting state-specific regulations in a Web application, handling encrypted fields and white space trimming on Web requests. Another group is looking to detect resource failures and short-circuit requests that would use them to avoid tying up threads (while checking for restored availability periodically). This is an interesting scenario for integrating with Glassbox to detect the outages, with custom logic to manage requests when there are outages.

Another interesting use case I heard about is audting data when committing transactions using Spring AOP. It turns out you can use the Spring ordered interface to ensure the audit logic can set up just before the transaction commits (so it can be included in the transaction!). However I don't see how you specify the order of the transaction aspect in @AspectJ aspects in the relevant Spring docs as of today (Oct. 25): it is shown in the XML schema-defined .

In my talk I also give an example of how to use Spring AOP to proxy persistent objects after a DAO returns them by executing advice after they are returned, say by a finder method in a DAO. Now this isn't as nice as using AspectJ to configure and otherwise advise these objects, but it can be a useful approach for those using Spring AOP but not yet AspectJ.  This code uses the ability to explicitly create @AspectJ proxies in Spring AOP code, which is also fine.

It's been interesting working a bit with @AspectJ with Spring: you can get good tools support by turning on AJDT while being ableto preserve very natural incremental development in Eclipse. I'm still continuing to use traditional AspectJ syntax for my projects, but like Spring AOP it can be very useful in projects that are starting to adopt AOP:

...
        @Pointcut("execution(music.model.Playable music.model.PlayableDao.find*(..))")
void createPlayable() {
}

@Around("createPlayable()")
public Playable proxyPlayable(ProceedingJoinPoint pjp) throws Throwable {
Playable created = (Playable)pjp.proceed();
return proxyPlayable(created);
}

public Playable proxyPlayable(Playable playable) {
AspectJProxyFactory factory = new AspectJProxyFactory(playable);
factory.addAspect(this);
if (playable instanceof PlayList) {
proxyChildren((PlayList)playable);
}

return (Playable)factory.getProxy();
}

void proxyChildren(PlayList playList) {
for (ListIterator

it = playList.getEntries().listIterator(); it.hasNext();) {
Playable child = it.next();
Playable proxy = proxyPlayable(child);
it.remove();
it.add(proxy);
}
}

September 06, 2006

Glassbox 2.0 automated troubleshooter Goes Beta

I'm pleased to announce that we just shipped the Beta release of the open source Glassbox 2.0 automated troubleshooter. Glassbox 2.0 is a major step forward in simplifying troubleshooting enterprise Java, just deploy it to your app server and it discovers your existing applications and automatically diagnoses problems. Glassbox provides a concise analysis of what’s wrong, focusing on relevant information like excessive queries, or parameters that cause failures.

Glassbox now offers an AJAX Web Client, improved analysis and an automated installer that makes it easy to monitor Java applications in either a standalone or clustered environment.  Under the hood, Glassbox continues to improve its monitoring and analysis to more easily pinpoint problems, Glassbox monitors selectively to allow very low overhead data capture, and we have been working with the AspectJ project to significantly reduce memory and startup time overhead. Glassbox is all open source with our CVS repository now hosted at SourceForge.

Please try it and let us know what you think.

screen shot

We’d enjoy showing you in person, too. We’re presenting Glassbox this fall at:

March 29, 2006

Industry Case Studies at AOSD 2006

Rob Harrop of Interface21 presented how Spring users were following the three phases of AOP adoption ranging from exploration and enforcement through infrastructure aspects and on to core domain uses. Rob highlighted some interesting examples of Spring users at each phase, ranging from reporting on enforcing architectural policy to using AOP to keep database views current. It is interesting that Rob uses IntelliJ with @AspectJ syntax: his AspectJ users are all on Java 5 and in general he sees projects that are still on 1.3 or that are on 5, but not many on 1.4. Ali Duck presented interesting findings from interviewing real world projects that were using AOP, mostly with great results.

Uwe Hohenstein of Siemens presented using AOP to automatically update database statistics to keep good query performance and Michael Mortensen of Hewlett Packard presented how they are using AOP with frameworks. InfraRED presented their approach to application performance management with AOP, now also using AspectJ 5 load-time weaving. Dean Wampler gave a nice presentation on lessons from his Contract4J tool that uses AspectJ to support Design by Contract. I also presented a case study on how we've been using AspectJ for monitoring UI and system events to improve the UI and to support macros at DaimlerChrysler with car diagnostic tools.

Alex Vasseur presented on BEA’s prototype of AOP support in the VM, an initiative I hope to see them continue investing in. Andy Clement showed the latest and greatest AspectJ Development Tools for Eclipse. Not only do they keep improving but I actually think AJDT is catching up to JDT, which is no mean feat. Those of us who use AJDT often complain about what’s not there, but it’s really impressive how much IS now working.

Demos at AOSD 2006

There were seventeen demos at AOSD, most of which were quite interesting. I was only sorry I couldn’t attend more of them! I presented the Glassbox Troubleshooter which uses AspectJ for Java application troubleshooting and the Glassbox Inspector data collector and had some good discussions with attendees about how it works and future directions.

I enjoyed seeing AO4BPEL which uses AOP for Business Process Mamanagement, by extending IBM’s BPEL engine BPWS4J to allow aspects to interact with business processes (e.g., adding promotions or performance monitoring across processes) and also to provide middleware aspects (like reliability and security) for SOAP messaging. I also was interested in a talk about Phoenix.NET, a research project for AOP on .NET, along with a discussion of how Microsoft is also concerned about a number of facets of AOP, in many ways relating to losing control. This probably sounds familiar.

March 27, 2006

Enterprise AOP Tutorial at AOSD

The week started off well as Dean Wampler and I presented a full day tutorial on Enterprise AOP to about 20 attendees. It was a great audience, mostly of experienced developers and architects who wanted to take their AOP and AspectJ knowledge to the next level. We taught the concepts of AOP and how to apply them in the morning. Then in the afternoon, everyone did well on the hands on exercises, which always test you after things sounded so straightforward in the lecture.

This followed a well attended AOP talk I gave at the Software Development West conference the week before. In both cases, I'm seeing more experience and knowledge among developers who come to talks about AOP, as well as interest in pragmatic questions about the next steps in adoption.

AOSD 2006 Conference Overview

I just returned from AOSD 2006 in Bonn, Germany with over 250 people in attendence even with TheServerSide symposium and EclipseCon happening the same week. There was good representation from architects and developers who came to share their experiences and learn more, as well as participation from tool developers and a large contingent of researchers and grad students. It's great to see the caliber of students who are excited about AOP and recent graduates who are using and promoting AOP at their new companies. 

Next year the conference is in Vancouver, and I'm responsible for publicity. I'd love to hear your ideas for how we can reach out to more of those interested in aspects. Some of this year's highlights follow as additional blog entries.

March 17, 2006

My New AOP@Work Article: Next steps with aspects

I'm pleased to announce the publication of a new article I wrote called "Next Steps with Aspects: After Learning Advice" as part of the AOP@Work article series on IBM Developerworks. The article gives advice for effective applications, integration, and adoption at each of these four stages of using aspects:

  • Learning and experimenting. I show examples of exception logging, performance tracing, and enforcement aspects and a technique to reuse library aspects.
  • Solving real problems. I discuss how to integrate AOP with tools and managing dependencies,  show how to implement license enforcement and error handling and how to extend library aspects using Glassbox as an example.
  • Integrating aspects into core development.  I look at using aspects for fine-grained authorization, keeping persistent relationships in sync, and for monitoring and recording macros in a UI. I also discuss some more advanced techniques such as exposing business relationships.
  • Sharing with others. This section looks at how to create reusable aspects effectively, looking at pointcut interfaces and using aspects to allow for feature variations.

I'd welcome your input on the article, and would love to hear how you are using aspects.

February 28, 2006

Glassbox Troubleshooter & Inspector 1.0 Released

We just announced the 1.0 Release of the Glassbox Troubleshooter product and the Glassbox Inspector project. The Glassbox Troubleshooter builds on the Glassbox Inspector’s AspectJ and JMX monitoring technology. The Troubleshooter adds root cause analysis and a focused GUI client that dramatically simplifies the process of Java troubleshooting. Our goal is to winnow down most of the common performance and reliability problems in enterprise development, providing a concise summary of what is wrong with supporting evidence to make it clear. The product is free to try, and we’d love your feedback! I see the product as especially helpful for finding problems in production and when integration or system testing code. See the screen shot below for an example of the kind of information it provides. You can also learn more at http://www.glassbox.com

Just last week, I had a great experience working with a manged service provider where they were able to download, install, run the product and get valuable information about their application in a QA environment in less than half a day (and half of the time was spent figuring out how to uninstall another monitoring product!).

p.s. Stay tuned for more about designing the next releases.

Glassboxtroubleshooter_1