« October 2004 | Main | January 2005 »

December 22, 2004

A Beautiful Language

I picked up one of my old computer science text books this holiday and started reading it. (Nothing like a good text book to unwind with as they say ;) [1]). The book in question is "Structure and Interpretation of Computer Programs" by Abelson, Sussman, and Sussman. It's a classic text written in 1984 and still used widely today (so I believe) to teach the art and science of programming in many university curriculums. The language it uses for this purpose is Scheme (a dialect of Lisp).

I know that I studied this book whilst at university (there are even some of my handwritten notes in the margins to prove it), but at that time what I mostly remember is learning enough about "cons," "car," and "cdr" to complete the programming assignments that went with the course. Reading it again now, after more that a decade of commercial programming in procedural languages, I'm completely struck by the beauty of the language and the approach.

For example, in the very first chapter is an elementary example of using procedures as parameters (a blurring of procedure and data). The procedure in question sums the values of some function f(x) across an interval from a to b, and takes as arguments the function itself, a, b, and another function 'next' that generates the next argument value. This is trivial to express in Lisp and fits completely naturally within the language. Lisp isn't the only language to let you do this of course. Ruby for example deeply integrates the concepts of blocks into the language. What's great about the Lisp version is that it requires no new syntax or special conventions, it just works, seamlessly. So well in fact that it makes an elementary example in the language.

Whereas the first chapter is about procedural abstraction, the second chapter is about data abstraction. Here you find another wonderful blurring of procedure and data with a demonstration that the most fundamental building block of data in Lisp, the pair, can in fact be implemented solely using procedures (and no data structures at all). This works because of another effortlessly natural thing Lisp allows you to do that Java doesn't :- return a procedure as the result of calling a procedure.

By only the fourth chapter, the reader is invited to construct an evaluator for the Lisp language (written in Lisp of course). Lisp has such a clean and simple syntax and semantics that this is a much easier task than it would be in many other languages. In fact there's a nice quote on the back of my edition of the book that reads as follows:

This book presents a unique conceptual introduction to programming intended to give readers command of the major techniques used to control the complexity of large software systems: building abstractions, establishing conventional interfaces, and establishing new descriptive languages.

If I look back over my programming career, I've built plenty of abstractions, and established many, many interfaces, but by comparison built very very few descriptive languages. This is probably for a combination of two reasons: one is that the languages I've been programming in don't make the establishment of a new descriptive language an easy and natural thing to do, and the second is that once you get out of the habit of using a certain technique, it tends to disappear from your toolbox after a while.

So at the end of the day, this is the thing that really impresses me about Lisp (and about the approach to teaching programming taken in the book). The language is so simple, and yet constructed in such an elegant way that it just doesn't get in your way - whatever abstraction you need to build, Lisp lets you do it in a very direct manner. Java just feels plain clunky when you put it alongside :- lacking in power, ease of expression, and beauty.

If I was to advise someone looking to go to university today to study computing, I'd recommend them to look for a place that first teaches programming using Lisp. Even though this is a less commercially attractive language than say Java, you'll learn much more directly the fundamental principles of programming. You'll then be able to apply these throughout your career in whatever language is flavour of the month (and no, it won't be Java forever more, you can be sure of that).

(1)Ok so, why am I reading a textbook on programming in Lisp? Do I read textbooks just for fun??? As you will have read above, Lisp makes the building of new languages a particularly easy task. This makes Lisp the language of choice for many text books and papers about programming language design and implementation. I like to study the foundational materials in any area in which I find myself working, and so given my role as lead of the AspectJ project, it makes sense to me to study Lisp for a season.

Posted by adrian at 01:54 PM [permalink] | Comments (4)

December 20, 2004

Great news from the Eclipse project

The Eclipse project just released Eclipse 3.1 M4. Read the New and noteworthy document to get an overview of the new features. This is a very significant release from AspectJ's perspective since you'll see in the JDT section of the new and noteworthy that:

The Eclipse Java compiler now supports all J2SE 5.0 (aka JDK 1.5) language features.

Whilst JDT itself still has some enhancements yet to be completed to the tools that sit on top of the compiler, this is all we need in AspectJ to move to the new JDT compiler level and get full support for compilation of Java 5 features. (And yes, once we've done that we'll have some work to do in the AJDT tools that sit on top of the compiler too, but we'll be a long way forward.)

I've taken a couple of weeks off over christmas (I'm actually on vacation now), but as soon as I get back in the new year I'll start work on the integration of the JDT M4 compiler into the AspectJ 5 M2 release. We'll move to the Eclipse 3.1 release level compiler as an incremental update once it is available, and ahead of any AspectJ 5 release candidate.

Posted by adrian at 10:57 AM [permalink] | Comments (1)

December 17, 2004

Who's Teaching AOSD?

I finally got around to collating the responses to the question I posed the aosd-discuss and aspectj-users list a few weeks ago: who out there is teaching a course about AOSD or AOP, or that includes some content on the topic? I'm really pleased to see how many replies there were, and just how much is going on in this space.

I've tabulated the results on the AspectJ site here. Many of these courses have online materials that you can browse. Note that not all of the entries are AspectJ courses, many of them teach other systems and approaches too. If you're teaching an AOP course and I haven't got it on the list yet, please let me know and I'll add you. If you're in academia, and your university isn't teaching some AOSD content yet, isn't it about time you started? ;)

In a similar vein, if you're looking to pick up some new skills in the new year, you could do worse than check one of these out.

Posted by adrian at 06:54 PM [permalink] | Comments (0)

December 15, 2004

AJDT 1.2.0 M2 Released

AJDT 1.2.0 M2 was released yesterday. If you haven't been following the AJDT 1.2.0 release stream, let me tell you that the M1 and M2 releases represent a major step forward for AJDT.

In the true Eclipse spirit, there are excellent new and noteworthy documents that describe the new features and give a graphical overview. Check out the:

In M2, as well as live updating of aspect members in the Package Explorer you also get live updating in the Outline View. You can now use the regular Java editor and Outline View for .java files, and still get to see all of the cross-reference information (advises, advised by etc.) through the new Cross-References View. A decorater marks Java element icons in all of the Java views to indicate the presence of AspectJ relationships for the element (simply click to see them in the Cross-reference).

AJDT is built using AJDT (and hence AspectJ). In this release we've exploited that with a bunch of aspects that give much better diagnostics in the event of a failure. We've also done much more testing on Linux, Mac, and even in the Rational products.

M2 also incorporates the latest AspectJ 5 M1 compiler so you can play with annotations too (and read and search the AspectJ 5 Developers Notebook from within the Eclipse help system). I met Erich Gamma in Antwerp on Monday, and he told me that the Eclipse 3.1 M4 build will contain a fully-featured Java 5 compiler, which means we can start to integrate that into AspectJ straight after the christmas break. I'm excited about that because then you'll be able to compile Java 5 (AspectJ 5) programs with ajc as well as weave Java 5 class files.

Posted by adrian at 03:51 PM [permalink] | Comments (2)

December 14, 2004

AspectJ at JavaPolis 2004

Yesterday was the first day of the JavaPolis 2004 University. I gave a three-hour session on "AspectJ in Action". (All the University session titles were of the form "XXX in Action"; "AspectJ in Action" also happens to be the title of Ramnivas' excellent book so I hope he forgives me - especially now I've given him a plug :) ).

They have a great setup here for JavaPolis - the conference takes place in a cinema complex with the sessions being held in the different screening rooms. That meant I got a great big room with a great big screen to project onto - perfect for showing off AJDT. The audience had to sit straight through for 2.5 hours with no break since a change in the conference start time ate up the morning coffee break. I tried to make the show as gripping as a Lord of the Rings film, but this was hard as the emotional content of the talk was fairly low and I wasn't fully able to exploit the surround sound system! Still, there was plenty of drama in the talk for me at least, since it was laced with live demos.

Highlight of the talk from my perspective was the live demonstration of Hibernate persistence using AspectJ - first time I've done that for an audience. I configured AJDT so that I could start mysqld as an external command straight off the Eclipse toolbar, and then set breakpoints in some around advice doing session management, some before advice doing session dependency injection, and a couple of DAO methods themselves. Then I launched the whole thing in the debugger and we stepped through it as we drove the DAOs through the UI. Everything worked perfectly - AJDT stopped in the around advice, we were able to step through it and then when we stepped over the "proceed()" call we immediately hit the breakpoint in the before advice (next in chain), and on stepping through that we went into the DAO method itself. We step returned back into the around advice to commit the transaction and return. The debugger really is a great teaching tool for illustrating AspectJ's dynamic join point model and helping people to understand the runtime flow of control of AspectJ applications. I think I will use this technique more often in future talks.

If you want to try this at home, a top tip for debugging around advice is to set the "no inline" option in the AspectJ compiler preferences page (advanced tab) - this causes AspectJ to generate much more "debugger friendly" code for around advice. Don't use this option in your ant builds though unless you really know that you want it for some reason since the generated code runs slower than inlined around advice does.

In the afternoon I got to go to the "Neal Gafter and Joshua Bloch" show (aka "Java 5 in Action"). The most striking thing for me was probably the title slide with the Google logo on it - reminding me that both of these guys have now left Sun and work for Google, amazing. Good to see that they're still able to come and give talks such as this though, and they promised to stay involved in the future development of Java through the JCP. (One of the AspectJ committers, Erik Hilsdale, is now a Google employee too - they really are a talent magnet at the moment). Their talk was a double-act tour through the new language features in Java 5. Nothing earth-shatteringly new (but then I have been crawling over the specs as part of the AspectJ 5 development so I'd hope not really), but the many repeated examples of code snippets did bring home two points very well: programs written in the Java 5 language really can be simpler and more concise; and the new language features are all very synergistic.

Posted by adrian at 09:19 AM [permalink] | Comments (2)

December 11, 2004

Early Christmas Presents... Early New Year's Resolution

Yesterday we posted an early christmas present to AspectJ users on the AspectJ site :- the M1 build of AspectJ 5. This represents a significant step on our way to delivering full Java 5 support and more early next year. Do check out our ongoing work on the AspectJ 5 Developer's Notebook which details a lot of the new features.

Then I realised how long it had been since I last made a blog entry.... way too long. So here's an early new year's resolution too: I will blog more often, I will blog more often....

It's not like there haven't been interesting things to write about - Charles Zhang and Arno Jacobsen reported on their work in refactoring middleware using AspectJ at OOPSLA, the ABC team released their AspectJ compiler, we've been doing a whole bunch of interesting language design, JBoss have stepped up to the IDE challenge and started building Eclipse plugin support for their AOP framework, AspectWerkz have put out some great releases, and the list goes on.... At list this will give me some material with which to make good on my new resolution!

A couple of more recent things to highlight. If you haven't seen them, we put up four demos of AspectJ and AJDT that you can watch right in your web browser - these give a great overview of the tools and I encourage you to check them out when you get the chance. AJDT keeps getting better and better. The 1.2.0 M1 release that is out right now has some great enhancements over what's in the demos, and the 1.2.0 M2 that will be coming out real soon (we're not done with those Christmas presents yet) has some really cool features that I'm very excited about.

I asked a couple of weeks ago on some of the aspects lists for folks who were teaching AOP or AOSD courses to get in touch. The response has been great! A big thank-you to all who replied (and if you are teaching a course and haven't yet told me, please do). I plan to collate all the responses and post the list on the AspectJ site (and I believe there's talk of a "teaching AOP/SD" BoF at next year's AOSD conference too). I take this level of activity at both post-graduate and undergraduate level in universities as a good sign, and as an indication to doubters that there is indeed more to AOP than "just another framework." When I graduated from university (I did just scrape through you know ;) ), object-orientation was an optional course in the final year of my degree. Two years later it was being taught in the first year of that same degree course, graduates were leaving universities knowing about it, and we were using it for serious commercial development. AOP is not quite in that position yet, but the signs are encouraging to me.

On the topic of teaching, our book (Eclipse AspectJ) is finally hitting the warehouses this month and will start shipping. We poured a lot of effort into that, and it will be great to finally have it see the light of day. Like many others it seems, I'm off to Belgium tomorrow for JavaPolis to give a three-hour AspectJ tutorial on the Monday. It looks like lots of old friends will be there too and I'm looking forward to seeing you again. After an intensive period of development it's great to get out and talk to some users again.

Posted by adrian at 07:22 PM [permalink] | Comments (0)