Vita Rara: A Life Uncommon

Java

Get the Running Version of Groovy


Categories: |

This isn't documented in the Javadoc. (There is not javadoc on this method.) It seems to return the running version of Groovy when called:

org.codehaus.groovy.runtime.InvokerHelper.getVersion()

Helpful if you really need to know.

Testing Non-Ruby Applications with Cucumber


Categories: | | | | |

Yesterday we got Cucumber working to test an older J2EE application that uses EJB 2.1 for its persistence layer. This application because of the J2EE EJB 2.1 beans has been very hard to near impossible to test in the past. I've been hearing about Cucumber for a while and we decided it was time to take a deeper look.

We plan on adding new features to this application using Rails, and over time porting the existing functionality to Rails. So, having a test suite written in Ruby that can test the application regardless of the underlying implementation was necessary. Cucumber with Webrat to the rescue. The general outline below will work with web applications written in any language. All of the interaction with the application happens at the HTTP protocol level.

Why I Chose JRuby Over Groovy


Categories: | |

After reading The power of JRuby and the discussion that ensued I was inspired to write about why I chose Ruby and particularly JRuby as my company's primary development platform.

I didn't write this post as a knock on Groovy. If it wasn't for Groovy I doubt I'd be working in Ruby today. For me Groovy was my "gate-way drug" into the dynamic language realm. My reason for this post is to explain why someone might want to use Ruby on the JVM over Groovy.

After working with Groovy for quite a while I started dabbling in Ruby. At first I really didn't get it. Then I watched a presentation by Dave Thomas and the lights went on. A world of possibilities opened up for me, and they were easily in reach.

How I Got Over "import java.util.*;"


Categories: |

It's taken me years, but I finally got over import java.util.*;. First, I don't use an IDE. I know an IDE could manage my imports, but I'm not an IDE guy. So, for years I've managed my imports manually, or given up and done import java.util.* and felt guilty about it. Well, I'm over that, and I can give Groovy the credit. By default Groovy imports java.util.*. I've been using Groovy every day now for about a year and a half and the house is still standing, our code compiles, we haven't had name conflicts. Things work, and it's a lot easier.

I used to worry about name clashes and compilation speed, and other shiboleths spoken of around coder camp fires and in hushed tones. After all everyone "knows" that the * should be avoided. Well, I'm over it, import java.util.* is just fine with me. Now when I start a Java source file I almost always just add java.util.*.

Using Dynamic Method Invocation to "Script" Java


Categories:

Although Java isn't thought of as a dynamic language now a days, what with Ruby and Groovy being all the rage, Java does have support for dynamic features. (See my previous blog post on the subject and the solution I came up with.)

A Use Case for Dynamic Java

Currently I'm wrapping about a hundred EJB 2.1 LocalHome classes in DAO's, and having them transform local EJB entities into POJO's. Much of the code is largely boiler plate. Actually it's mind numbingly boiler plate. Here's a sample of wrapping a finder:

What's Wrong with Java's Dynamic Dispatch or "How I Implemented sendMessage()"


Categories:

(Related article using this technique to "script" some Java objects: article.)

The following code quickly illustrates an issue with the Reflection API's in the Java language. At run time finding methods on classes requires that the types passed to Class#findMethod() exactly match those found in the method declaration. The JavaDoc and language spec refers to these as the "formal parameter types".

The issue is, I have a method that takes an A, and I have an object of B that extends A. If you run the following code it will fail, being unable to find the method.

Closures and Bindings in Groovy


Categories: |

You can learn something every day. That's what is so nice about being a software developer.

Today I was looking at some Grails code, seeing how some of the metaprogramming features of Groovy are used in the framework. After poking around I decided to look at the ServicesGrailsPlugin to see how the automatic wiring of services was done, and ran across the following code:

def doWithSpring = {
  application.serviceClasses.each { serviceClass ->
      def scope = serviceClass.getPropertyValue("scope")

    "${serviceClass.fullName}ServiceClass"(MethodInvokingFactoryBean) {
      targetObject = ref("grailsApplication", true)

Yes the JVM is a Multi-Language Platform


Categories: |

Although talk about multiple languages running on the JVM has grown over the past few years, the reality of it really hit home with me this morning. I turned to one of my employees who has been doing JVM development for me since April of last year. The interesting thing is probably 95% of the JVM work he has done isn't in Java, it's in Groovy. Here's to the multi-language Java platform and a thank you to those developers who are making it a reality.

The Future That Has Already Happened


Categories: | | | | | |

January second's Daily Drucker dealt with the future, but not as most business prognosticators or futurists might. As Drucker states it, "The important thing is to identify the 'future that has already happened...'"

The action point for the day is to identifying those trends in our market that have already happened, write about their longevity and their effect on our life and organization.

Software as a Service For the Rest of Us

Over the past few years, and particularly in 2007 Software as a Service (Saas) has really broken out and has become a force in the software industry. The first large scale SaaS offering that really broke through to my consciousness was Salesforce.com, then for me came Basecamp from 37signals.com. Salesforce.com represented a high level enterprise offering, with a high level of complexity and expense. Basecamp brought software as a service home to us all.

2007: A Retrospective


Categories: | | | | |

Personal Life

Sylva and I got married on April 28. It's been a real whirl wind since then. We are expecting our first child on April 1, 2008. My time with Sylva is special and precious. I have a great partner, and look forward to raising a family together.

Overall business issues have dominated this year. I doubt that will be that case next year.

Business

It was a hard business year, but prospects for the future look good.

Quadran

Quadran has arrived. About 63,000 lines of Groovy, Java and JSP, with some XML files to wire it all together, and it's up and running. We turned on our first Quadran installation on December 5, 2007. This was the culmination of a process that began with an initial meeting in September of 2004, and the consummation of the development agreement in July of 2006.

Syndicate content