Speaking at CJUG, 5/19
May 19th, 2009
Update: The talk is tonight (Tuesday). The 4th Chicago Area Scala Enthusiasts meeting is Thursday evening.
I’m giving my JavaOne talk at CJUG this Tuesday evening.
The title is Don’t Do This! How Not to Write Java Software. I’ll discuss ten issues I often encounter in Enterprise Java applications, why they are bad, and how to correct them.
Please join me!
ANN: 1st Ever Chicago-Area Scala Enthusiasts (CASE) Meeting
February 4th, 2009
We finally got organized; I’m pleased to announce that we’re holding our first meeting at 6:00 on Thursday, Feb. 19, at the Chicago ThoughtWorks offices. Our google group is chicagoscala and more information about the meeting can be found in this message. We hope to see you there!
Organizing a Chicago Area Scala Enthusiasts (CASE) Group
January 17th, 2009
I’m organizing a group in Chicago for people interested in Scala, called the Chicago Area Scala Enthusiasts (CASE). If you’re interested, join the google group for more information.
"The Seductions of Scala" Presentation
December 16th, 2008
I posted an S5-based presentation called The Seductions of Scala (Zip). I'm giving this presentation tonight at CJUG.
To view it, unzip the file and open html/all.html in your browser. Use the arrow keys to navigate or the controls in the lower right-hand corner (visible when you mouse over).
The corresponding code is in the code directory.
Feedback welcome and I hope to see you tonight!
Slides from My QCon Talk
November 20th, 2008
I posted an extended version of the slides from my QCon San Francisco talk, Radical Simplification Through Polyglot and Poly-Paradigm Programming (PDF). The PDF includes some slides I skipped in the actual talk, for time’s sake.
InfoQ.com may offer a video of this talk. Stay tuned.
Writing a Book on Scala
October 5th, 2008
I’m pleased to announce to Alex Payne (of Twitter fame) and I are writing a book on Scala, a new language for the JVM that combines a succinct syntax, an improved object model and type system, and full support for functional programming. O’Reilly will be the publisher.
I’ve blogged about Scala on the Object Mentor blog.
I switched to Mephisto
October 5th, 2008
Announcement: Polyglot Programming Site
August 24th, 2008
Raising a different exception in "after" or "after_raising" advice
April 26th, 2008
An Aquarium user asked recently if you can use after_raising advice to raise a different exception, e.g., to wrap the original exception. Now you can, with the commits I did today. (This change will appear in the forthcoming V0.4.2 release.) Actually, this feature was partially implemented already, but never finished (OOPS!)
The following made-up example illustrates what you can do. Imagine you are one of the handful of Ruby programmers who aren't using ActiveRecord ;) and you have an OracleDriver class that handles Oracle database transactions.
class OracleDriver
class OracleDriverException < StandardException; ...; end
class ConnectionError < OracleDriverException; ...; end
def connect
if try_to_connect == false
raise ConnectionError
end
...
end
def find query_parameters
...
end
end
In the application code that uses the OracleDriver you ignore any exceptions raised (because we will implement an exception handling strategy elsewhere...).
...
def load_object oracle_driver, query_parameters
oracle_driver.connect
oracle_driver.find query_parameters
end
...
Finally, you implement an application-wide exception handling strategy for any exceptions raised by the driver.
Aspect.new :after_raising => OracleDriverException,
:in_types => ... do |jp, object, *args|
# Ruby needs a standard way to wrap one exception in another.
original = jp.context.raised_exception
app_exception = ApplicationException.new(original.message)
app_exception.set_backtrace(original.backtrace)
jp.context.raised_exception = app_exception
end
In other words, any exceptions raised by calls to OracleDriver are wrapped in an ApplicationException, which will be thrown by Aquarium when the advice block finishes.
This technique can also be used when handling exceptions in after advice.
By the way, in a similar way, you can also change the return value in after and after_returning advice. In this case, you assign a new value to jp.context.returned_value.
Short presentation on Aquarium
April 2nd, 2008
ANN: Aquarium V0.4.0 Released with Initial Support for Java Aspects in Aquarium
February 26th, 2008
ANN: Aquarium V0.3.0 released
January 21st, 2008
I released V0.3.0 of Aquarium today. The most visible change is a new set of synonyms for many of the parameters passed to API methods, providing a more "English-like" feel. For example, previously, you might declare an aspect like this:
around :methods => :all, :types => [Foo, Bar], :advice => advice_proc
Now you can write the same aspect as follows:
around :calls_to => :all_methods, :within_types => [Foo, Bar], :use_advice => advice_proc
which reads more like English.
Similarly, attribute matching is simpler.
after :attribute => name, :attribute_options => [:readers], :objects => [foo, bar] ...
becomes
after :reading => name, :on_objects => [foo, bar] ...
There are many internal improvements to improve DRY'ness, robustness, and performance.
There should be no upgrade issues, so give it a try!


