May 5th, 2008 — Ruby
Lovely start to the day. 2 miles from the hotel, my Prius breaks down and won’t start. WTF?! FAIL! Oddly, 30 minutes later (after perusing the sample app that we’re going to discuss during the class), the car starts again with a warning light. During the class, I’m fucking Grand Central Station: my cell phone rang 4 times before lunch. Again, WTF? I’m not a popular guy. Yeesh!
Hehehe… and Twitter went down just before lunch. Sometimes it’s nice to remember that I’m not the only one who is living in interesting times.
Regarding my notes, it’s worth mentioning that I’ve done a bit of Rails 1.2.x development but haven’t touched Rails 2.x until today. That said, as of this morning, I was comfortable with the theory of REST but not the Rails implementation.
Anyhoo, my notes from Day 1 of the class follow after the jump.
Continue reading →
May 2nd, 2008 — Java
I know, I know. Java. Blech!
But if you have to work in Java, instead of something more elegant like Ruby, wouldn’t you like some of the same awesome mocking power that you have come to know and love in Java? Yeah, me too.
Toby DiPasquale turned me on to jmockit. It’s a little framework that provide RSpec-like mocking in Java. To those familiar with RSpec: jmockit allows developers to mock constructors as well as individual method on live objects. It accomplishes this courtesy of the java.lang.instrument package that was added in Java 1.5.
I was curious to see if it is possible to mock boot classloader loaded classes (i.e., java.lang.Integer, etc.). After a few minutes of tinkering, I found a way but it’s none to pleasant…
Continue reading →
April 26th, 2008 — Ruby, Utility
Giles Bowkett brought us Pastie of the Mac clipboard from IRB via the Utility Belt gem. If you aren’t using it already, ’sudo gem install utility_belt’. I highly recommend it.
That said, I’ve since longed for the same capability but from the command line.
Continue reading →
March 22nd, 2008 — Ruby
Chris Sepulveda recently wrote a great article discussing why he believes that Ruby and Rails will ultimately topple Java in the enterprise development space.
He’s not the only one. I’m often hearing Rubyists talk about how, once the Java community “crosses the chasm”, we’ll rule the world. I seem to recall that Smalltalkers had the same notion at one point…
And yet Chris drew an analogy that caught my eye: “Rails is not unlike other early-technulogies in this regard (consider Java in 1996-98).”
I often use a similar analogy when attempting to introduce Ruby and Rails to other Java old-timers: “Remember Java way back in 1997? Yeah, that’s Ruby right now” implying that fame, fortune, and glory await but a few years away for those who hop on those Rails now.
To an extent, the analogy holds. Between ‘96 and ‘98:
- Java was slow as a dog. (Ruby: check)
- Java was immature. There were few class libraries available. (Ruby: hrmm… let’s come back to this)
- Sun/Java struck gold with J2EE v1.0 in ‘98-’99. (Ruby: Rails - check)
- Arguably, Java web development didn’t achieve “maturity” until early versions of Struts appeared on the scene and provided structure that was sorely lacking within the typical J2EE app pre-’99 (Ruby: Rails - check, Merb as well)
However, I still have some reservations about this analogy. As of ‘98:
- Java had been around for 3 years. As of today, Ruby has been around for 13 years. It wasn’t until recently with Rails that Ruby came out of the Sinai and found its land of Milk and Honey — maybe.
- Java had Sun vigorously evangelizing Java like the snake oil of the millennium whereas Ruby, instead, has several small consulting firms and a vocal community of passionate developers (myself among them).
- Java had a pittance of available libraries whereas there are a plethora of available Ruby libraries today.
Let’s face it: in the enterprise, more often than not, it’s not the engineers who pick the technologies: it’s the pointy-haired morons who wear ties to work every day, have stock in the company, a sizeable six-figure income, drive a BMW (bullshit on the inside), and pick technulogies that are “safe” (i.e., they cost lots of money — like Oracle or Microsoft) instead of technologies that can save money (like Linux or Ruby or other OSS).
Of course there are small pockets where sanity reign. One of Chris’ commenter’s henpecked Relevance’s Streamlined framework; however, Stu will tell you that they often submit two bids for their contracts: one to be implemented in Java and the other Ruby. Do I really need to tell you which bid most of his customers pick? What does Relevance use to implement many of their web apps? Stu told me that they built Streamlined to help them quickly develop web apps that, while they won’t win beauty contests for web design, handily get the job done and can be constructed in short order.
At the end of the day, to the enteprise, shouldn’t that be what matters? More value for less money? We engineers often tend to be idealists. If one technology does something better than another and can easily be adapted to play well with the technologies of the past, we deem it a winner. Sadly, the best ideas often lose despite technical merit.
March 4th, 2008 — Groovy, Ruby
class Robot
{
def type
def height
def width
def access(location, weight, fragile)
{
print "Received fragile? ${fragile}, weight: ${weight}, loc: ${location}"
}
}
robot = new Robot(type: 'arm', width: 10, height: 40)
println "${robot.type}, ${robot.height}, ${robot.width}"
robot.access(50, x: 30, y: 20, z: 10, true)
Republished from Venkat Subramaniam’s Programming Groovy (Beta, p. 39)
…outputs the following:
arm, 40, 10
Received loc: ["x":30, "y":20, "z":10], weight: 50, fragile? true
If you’re a Ruby programmer, the second line is going to look seriously bizarre. If you’re not, I’ll explain why. In Ruby, you can pass a Hash (think java.util.Map) inline in a method call with the following syntax:
foo("param1", param2, :hash_key1 => val1, :hash_key2 => val2)
According to Groovy, when a Map is inlined as a argument to a function, by convention, it is the first parameter on the method. If it is not passed in as the first argument then it is coerced into becoming the first argument. The Ruby interpreter will error if you pass an inlined Hash as any argument other than the last. Forgive me but Groovy’s coercion of parameter ordering is just fucking weird.
February 25th, 2008 — Ruby
Recently, I was writing some simple statistical calculation software running tests on small data sets with a floating sample “window” through the data. Basically, this becomes a O(n^2) over Mann-Whitney U. It was fast enough for small data sets — that is until I was asked to scale the data size by about an order of magnitude.
What to do? We had plenty of hardware and I was developing on a quad-core Xeon (!!!) so why not throw more hardware at it. I was only using one core. So how do I get to the other three?
Enter
Rinda — a Ruby implementation of
Linda.
Continue reading →
February 9th, 2008 — Ruby
After far too much goofing off, I’ve finally gotten off of my tuckus (metaphorically only
) in order to write some code. In a few short hours of work, I’ve almost finished a first pass at my Wikipedia film gem. It’s sole purpose is to help me automate the download of movie synopses and posters for movies stored on iTunes for display on our AppleTV.
I’d left this project fallow for at least a half a year now. It was amusing to return to it later, with far better Ruby chops, and get it working. Now that the unit tests pass and the movie lookup driver seems to handle the majority of the bizarre errors that can occur as a result of the imperfect taxonomy used by Wikipedia, I’ll probably post a link in the next few days.
December 18th, 2007 — Ruby, Ruby on Rails
Lo and behold, Omni Group’s OmniFocus beta used to have a web application built in to allow folks to, say, expose a web server via dynamic DNS that provides web access to their OmniFocus’ projects and contexts.
That app is written in, you guessed it, Ruby on Rails!
The current version of the web application is available here.
Oh, and I just double-checked with Omni: they’re AOK with starting a project up on RubyForge to maintain the OmniFocus web application under an MIT license.
I know what I’m going to be playing with for the next several days/weeks/months now….
October 31st, 2007 — Ruby, RubyOSA
Steven Bristol noted that the posted version of my “Change IM Status” script doesn’t work in Leopard. That may be as I’ve tweaked the heck out of it over the past several months but never posted the updates.
Hell, this is the first that I’ve heard of anyone else using the little beast. Cool!
What I really want to do with my IM/messaging apps is selectively block contacts programatically. This would let me build an “I’m Working” state where I could block out the world except for my immediate colleagues, for instance. Being somewhat ADD-ish (show me a developer who isn’t!) and a nearly-compulsive checker of incoming e-mail/IMs, this would be huge for me. I’m DYING for this.
Sadly, neither app seems to provide that level of event to OSA such that I could “veto” an incoming chat. I’m probably SoL regarding Skype but perhaps not so with Adium. I taught myself Objective-C for shits and giggles a few months ago after a chat with uber-hacker Marcel Molina. Maybe the Adium folks would be amenable to a new feature?
I’d still prefer for an event-based architecture where I could register my app for OSA events from Skype/Adium and use them to effect Skype/Adium.
Hrm. I wonder if iChat provides a more robust OSA model? Worth a looksy.
P.S. I’m ticked that the “Current Application” -> “Show Menu Items” feature of Quicksilver seems to be broken in Leopard. I loved this feature for blog posting from TextMate…
October 1st, 2007 — Ruby
Ruby East, on the whole, was a fine conference. I, and several other conference attendees, noted that the local Ruby conferences seem to be just that: Ruby conferences. They seem to eschew addressing Rails and prefer to discuss a wide range of topcs.
I really like this.
I was among many who expressed disappointment with the high level of abstraction in the RailsConf ‘07 talks. Very few of them got into the weeds, talked about the code, and challenged the listener technically. I’m not sure about the (extremely few) rest of you but I go to these conferences to hear what my peers are doing, why, and determine if I should consider trying new technologies and techniques. For that to occur, I need to obtain at least a certain minimum depth of technical knowledge of a topic. Hoedown (especially) and Ruby East proved satisfying in that regard.
And, of course, there was Werewolf. Travel to exciting conferences, meet new and interesting people, and lynch and/or eat them. Who would imagine that a game involving argument, bluffing, and outright coercion could be such a team building exercise? It was a pleasure meeting, eviscerating, and being eviscerated by everyone.
Anyhow, below are my notes from Ezra’s Ruby East talk — far and away my favorite talk. For more notes from Ruby East, see Giles Bowkett’s notes on Pastie.
Continue reading →