Groovy Domain Specific Language Tutorial

August 17, 2008 – 8:42 pm

Although it may seem like an advanced topic, writing a simple Domain Specific Language (DSL) in Groovy is actually pretty easy. Groovy’s dynamic nature and metaprogramming capabitlities give developers all the tools they need to quickly and easily write their own DSL.

Read the rest

Ruby Nation: Day 2 Wrap Up

August 3, 2008 – 6:49 pm

Opening Keynote - Rich Kilmer

Rich Kilmer’s opening keynote was by far the best presentation of the day. Rich is an incredibly experienced and skilled Ruby developer who was one of the earlier adopters of the language. During his keynote, Rich walked through his experiences with Ruby dating all the way back to 2001. He has certainly worked on some interesting projects for impressive government agencies including DARPA and the United State Air Force. Rich also talked about projects he has created for the Ruby community including FreeRIDE - a Ruby IDE and RubyForge - a code repository for Ruby projects.

One particularly interesting thing Rich mentioned was that Ruby is becoming a mainstream language. I personally find this both exciting and scary. It is exciting that the community is growing at that there will likely be more opportunities to work on Ruby projects professionally, but it is a bit worrisome that the community could start to be overpopulated with run-of-the-mill developers transitioning from other dying mainstream languages.

Read the rest

Ruby Nation: Day 1 Wrap Up

August 1, 2008 – 11:59 am

Ruby experts and enthusiasts from around the country met in Washington, D.C. today for the first annual RubyNation conference. I always think it’s awesome to get together with industry leaders to absorb and share new information and insights. I’ve been to quite a few tech conferences in the past, but I’ve never been as engaged and attentive as I was today. There is an energy around Ruby and Rails that I have yet to witness with other technologies. I continue to be amazed by how passionate and open the community is as well. I met and talked with more people today than all of the other conferences I’ve attended combined.

In case you weren’t able to make it, here’s a quick rundown of today’s events:

Read the rest

Putting Google Finance to REST with Ruby

July 23, 2008 – 2:43 am

RubyNation is just a week and a half away and in order to prepare myself I thought I’d brush up on some Ruby and Rails in the days preceding the conference. I don’t use Ruby on a regular basis, but I’m a huge fan of dynamic languages so I’m really looking forward to attending the conference and finding out what’s new in the Ruby community.

By day I’m a Java developer, but I’ve also spent a fair amount of time studying Groovy. Learning Groovy has been my “training wheels” approach to understanding dynamic languages. Studying Groovy has helped me grasp new (new to me at least) concepts like Metaprogramming and Domain Specific Languages all from the comfort of my Java environment.

Read the rest

Putting Google Finance to REST with Groovy

July 16, 2008 – 11:07 pm

For a while now I’ve been interested in learning more about building and consuming REST based web services. Fortunately, many tech giants including Google and Yahoo expose much of their data and functionality through REST based APIs. These powerful APIs, combined with Groovy’s concise, readable syntax make it very easy to learn about the REST software architecture approach.

This particular blog entry makes use of Google’s Finance Data API. I’ll explain how it is possible to programmatically authenticate with Google, create a new stock portfolio, and create positions (buy and sell stocks) within this portfolio by making REST based service calls. I won’t dive too deep into the details of the REST architecture, but if you have a general understanding of XML and the HTTP protocol it won’t be too difficult to follow along. For more information on REST, please see the links in the Reference section below.

Read the rest

Groovy Metaprogramming – Creating Behavior on the Fly

July 8, 2008 – 12:07 am

In my previous post I talked about dynamically adding behavior to Groovy classes using either the ExpandoMetaClass or Categories. These techniques are especially useful if you know which methods you would like to add to your classes prior to actually writing any code. But what if you don’t know which methods you will need before code writing time? What if you want to allow yourself the flexibility to call methods arbitrarily without defining their implementation beforehand?

To the average Java programmer (myself included), the idea of generating methods on the fly might seem bizarre at first, but Groovy’s built in method interception capabilities allow programmers to easily realize this type of functionality in their Groovy code. In Groovy Metaprogramming - Adding Behavior Dynamically, I discussed how to add a method to the java.math.BigDecimal class to allow for the conversion of U.S. Dollars (USD) into Euros (EUR). What if, however, I wanted to convert from USD to British Pounds (GBP) or to Japanese Yen (JPY)? I could certainly write a method for each of these conversions, but what if there was a better, cleaner, and more flexible way to build in this functionality?

Read the rest

Groovy Metaprogramming - Adding Behavior Dynamically

June 29, 2008 – 10:00 pm

I’ve been fascinated with languages like Ruby and Groovy ever since being exposed to their dynamic capabilities. I remember attending a No Fluff Just Stuff conference a few years ago and being awestruck while watching Dave Thomas build a full-blown Rails application within a matter of minutes. Dynamic languages give programmers the ability to write powerful and flexible code that is both readable and concise. But what is it that gives these languages such great power? The secret is their metaprogramming capabilities.

Metaprogramming is the ability of a computer language to manipulate other programs (including itself) to add or create functionality in a dynamic fashion. In Groovy, metaprogramming is especially useful because among other things it gives programmers the ability to easily implement domain specific languages, create builders, or generate mock objects for unit testing. Adding functionality to pre-existing Java or Groovy code can be accomplished by using either the ExpandoMetaClass or Categories.

Read the rest

Easy AOP with GroovyInterceptable

June 18, 2008 – 2:56 pm

Aspect Oriented Programming (AOP) is a technique that can be used to eliminate the repetition of cross-cutting concerns (logging, security, transaction management, etc.) in code. AOP is useful because it provides programmers with a single point at which code can be modified and take effect across an entire system, but integrating AOP frameworks into traditional Java applications tends to be somewhat cumbersome and complex. Conversely, adding AOP-like features into Groovy code is as simple as implementing the GroovyInterceptable interface.

Any Groovy object that implements this interface will automatically have all of its method calls routed through its invokeMethod() (assuming of course that this method has been implemented on the Groovy object itself or on its MetaClass).

Read the rest

Book Review: Bulletproof Web Design

June 12, 2008 – 8:06 pm

Bulletproof Web Design

Author: Dan Cederholm
Rating: 4/5

When I first started toying around with computers in the mid-90s one of my favorite things to do was create websites using free services like Geocities and Tripod. Back then I was guilty of all the deadly web design sins: table based layouts, pointless animated GIFs, heinous font and background color choices, and of course using the dreaded “Under Construction” page. Today I’m a little smarter about my design choices and feel that while web design as a whole isn’t quite where it needs to be, it is getting much better and there’s no doubt it’s because of books like Bulletproof Web Design by Dan Cederholm.

Read the rest

Hello World!

June 11, 2008 – 9:02 pm

Hey, welcome to the Fiascode blog! This is my personal technology blog focusing on the latest trends in software development. Be sure to check in often for tutorials, news, and my thoughts on the tools and technologies that I am currently using for development.

Feel free to subscribe to the RSS feed to have the latest posts from this site appear directly in your favorite RSS reader.

If you’d like to contact me, just leave a comment on the site or send me a message via my LinkedIn Profile.

Thanks for visiting!