Tomorrow (Tuesday) I’m going to be giving my “Building DSLs with Groovy” talk at the UniForum group at IIT’s campus out in Wheaton Illinois. I imagine that the talk is only open to UniForum members, but it looks like you can become a member simply by attending a meeting (and paying the fee).
So if you live in the north western outer rim of the Chicagoland area and are curious about Groovy, come and check it out.
Update: The slides from the presentation can be found here for anyone interested.
I’ve always been a fan of glass mugs. In addition to being able to see what I’m drinking, I prefer their smooth feel to that of standard ceramic. Recently however, a friend turned me onto grails. On the surface, it would seem that grails are a throwback from an era long past, but there is something to be said about drinking from the satisfying heft of a jewel encrusted grail made of bronze that helps me get in touch with my northern Germanic roots.
I especially like drinking out of grails when working with the Groovy web framework, Grails (no relation). As a side note, here are a few reasons I like Grails (the web framework):
I had been working with Groovy for about a year before coming to Grails (that is, the web framework — I was still drinking out of glass mugs at the time) in the context of a Java desktop application. There was a lot of “split brain” development with about 30% Groovy and the rest Java. It was always a painful context switch back to Java from Groovy, consoled only by the IDE’s superior compiler support (”There, there, look on the bright side: I can look up your methods for you again. By the way, you need to catch this exception and you forgot your semis).
Grails is 100% Groovy though — config files and all. In fact, I wish they would have taken this further with the gsp syntax, but I guess you’re not really web programming unless you have those god forsaken tags somewhere in your application.
I’ve been actively avoiding using Spring in projects due to sheer intimidation, which can be summed up in the following exchange:
Coworker: Are you using Spring on your project?
me: You mean the Dependency Injection framework? We’re just using Google Guice–
Coworker: Oh but Spring is so much more than that — it also handles security and transaction control, and aspects, and it has a small island off the coast of Haiti, and it’s currency is the Spring Buck, and on clear nights if you quiet your mind, you can hear its song…
I’m told that Grails uses Spring behind the scenes, but I don’t have to know about it, which is the way it should be.
There is this tension with regard to testing out there where on the one hand there is the Public Face of Software Engineering, which includes every software book I’ve ever read or speaker I’ve ever listened to, that says that testing is very important and that you should unit test all your code.
Then on the other hand there is my primary experience of the dozen or so projects that I’ve been a part of over the last decade plus in which testing was always (at best) an afterthought, and even when we did set out with the best intentions, with our TDD hats on, a project always degenerates to the point where if we achieved 30% coverage we were feeling pretty smug about ourselves.
So the short of it is: regardless of what they tell you, testing is hard.
With Grails though, testing is…less hard. Tests are auto generated, and neatly stubbed out in their “unit” vs “integration” buckets just begging for some love. The great thing though is that, unlike my previous experience with writing tests, I don’t have to pretend that I’m not using a real database, or making a real HttpRequest. All that stuff is mocked out, which I realize you can do for any type of system, but the true gem is that I don’t have to set it up.
The testing is actually so effortless, that it actually encourages me to think about better design in that I will gladly refactor, say controller logic out into a service if it means a cleaner test.
I should also say at this point that while I’ve been drinking out of grails for a few months now, I’ve only been on a Grails project for a week, so these initial impressions may seem naive to the seasoned veteran. Nevertheless, I give grails a thumbs up — just avoid the ones lined with lead.
My good buddy Paul Lamere has moved on from Sun Microsystems to join a Music 2.0 startup. Paul was my mentor early on, and any quality in programming that I have managed to squeeze out over the years I attribute to him.
It sounds like the first thing his new company will need is funding for headphones to combat the global play list problem that they’ve recently encountered.
Anyway, make sure you update your readers to follow his new blog — it sounds like there will be some exciting stuff happening in this space soon.
It looks like version 1.1 of the JavaFX SDK has been released, which now officially includes Mobile support. It also includes “Full Screen” support which is a great bonus for game development.
Exciting stuff…
A while back my colleague, Shane Johnson, blogged about a CMIS browser he had written using Flex/AIR.
If you’ve come to this post for the “JavaFX”, or if you’re me from a week ago, here’s a bit of context: CMIS (Content Management Interoperability Services) is a specification that defines a set of Web Services which can be used to interface with a content repository.
So I went ahead and wrote a complementary visual browser in JavaFX. Flex’s strength is surely in its rich widget toolkit, and since JavaFX is currently lacking in this area, I decided to concentrate on a more visual approach. Incidentally, I developed this browser on a local instance of Alfresco Labs.
Here’s a screen shot of the browser after it first connects:
The “node” in the center of the screen is the root, or “Main Repository”, with the children nodes fanning out in front. Clicking on any of the children nodes will promote the child to the center and retrieve its children. Here’s a screen shot of what it looks like when the child “Data Dictionary” is clicked on:
Note that the previous parent “Main Repository” is promoted to the top and pushed to the background. Clicking on the parent will allow the user to browse up the hierarchy.
I was going for a 3D-ish look for the nodes. Each node has a three color Radial Gradient, which helps fake a specular highlight (as if the light source were off to the left). The connectors are a two color Linear Gradient that fade to black as they approach the center node so as to add to the illusion of depth.
Alfresco does seem to have some Java bindings for a CMIS API, but they seemed a bit incomplete, so I settled on using the ATOM bindings as the path of least resistance. Unfortunately though, not completely resistance-free as JavaFX’s PullParser does not yet support ATOM feeds (although it supports raw XML). So I ended up using Apache Abdera wrapped in JavaFX’s HttpRequest object for transport.
The browser is functional as I’ve described it, but I had bigger plans. For example, since this is a visual browser for content, I wanted to graphically show previews of the images and documents, as evidenced by the following screen shot:
So in this case when the user navigated down to say, their favorite band pictures, they would actually see the pictures (this would also apply to favorite PDFs or text documents). (Incidentally, the astute reader may look at these two pictures, and look at my Gravatar and wonder: does this guy wear the same thing at every show?)
But it turns out that this is actually a very difficult feature to implement. JavaFX’s Image object will only take a URL as a String, not an InputStream. Since Document Repositories generally require authentication, the content (images in this case) would have to be retrieved via the HttpRequest object (in order to stuff the credentials in the HttpHeader).
It would have been nice to be able to pipe the InputStream from the HttpRequest to an Image object, but such is not the case. So there was no easy way (that I could see) to render an image from a password protected URL (if anyone knows of a better way, please let me know).
Update: Josh aptly informs me that there is indeed a “fromBufferedImage” utility method in the Image class. Thanks, Josh. If only I would have scrolled down that far in the API docs…
Anyway, so there it is. I imagine the ideas in this visual browser could be applied to any type of tree structure.
For those interested in running the Radial Visualizer from a few posts ago themselves, here’s a link:
Click on the button in the upper left to toggle to the last.fm tag data set. I also added a bit of interactivity. If you hover over a tag it will highlight the connected tags to make it a bit easier to read (this is more useful on the 180 last.fm tags.
So my company, CityTech, has recently overhauled its web site, and I’m sure you’ll agree, it looks really nice. As you’ll note, the top few posts from our company’s blogroll are aggregated off to the left.
Since I first saw the new site go live last week, I couldn’t wait to write a post and take the place of honor just south of our corporate logo.
But it turns out that writing is actually very difficult…
I suppose I could have blogged about how Java Passion is running a free JavaFX course, but that’s old news at this point (although you can still sign up).
I could have mentioned that Josh Marinacci has just blogged about how developing for JavaFX Mobile will be no different than developing for JavaFX desktop (under the Common Profile, which, no, does not include Swing). That would be timely, but I didn’t really have any insight to add to it.
So I decided to crack under the pressure, and, attention starved, decided to write a post about nothing (sorry for bumping you, Bill, but you understand the allure of seeing the first few words of your post against that silky brown background).
For the next few hours at least I’ll be able to see my post here on this Sidebar of Wisdom until my eager colleagues feel compelled to write new posts bumping me off the front page and into obscurity.
When that happens though, be sure to be on the look out for my followup post: “You Can’t Bump Me From the Front Page That Easily!”