Jan 31 2007


Write for Others as for Yourself

Don's post about the Sellsian Approach is right on. This dovetails nicely with what I love most about Ruby: the ease with which you can give your fellow programmers a domain specific language instead of an API. Last week I found myself leaving a comment "for the next programmer" that looked like this:

  # foo must be a Hash of String to Widgets 

My gag reflex took over, and so a few minutes later I committed the following executable Ruby instead:

  invariant 'foo is a Hash of String to Widgets'

With regular expressions, instance_eval, and threequals, it was trivial to make invariant into a fairly general mechanism.

Jan 22 2007


Star Wars: The Real Story

Saw this link on BoingBoing today. Off topic, sure, but a wonderful re-examination of the plot of Episodes IV-VI in light of the information divulged in I-III. Specifically, the roles of R2D2 and Chewbacca finally laid bare. Wonderful stuff.

Jan 10 2007


Enterprise Ruby Studio in MARCH

There's a growing acceptance of Ruby as a player in developing "enterprise" applications. The upcoming "eRubyCon": in Columbus is just another example. Which is why we are proud to be bringing you another edition of our "Enterprise Ruby Studio":

In conjunction with the Pragmatic Studio, Relevance was the first to bring an open training event dedicated specifically to Ruby in the Enterprise to the market. We're running it again March 28-30 in Reston, VA. Once again, we'll be focusing on Ruby's unique value in the enterprise as the "glue that doesn't set". Attendees will experience, hands on, building an app using the most important technologies: data access through ActiveRecord and rBatis, messaging through Stomp, Drb and Rinda, data transfer using XML and JSON, networking using Mongrel, and building RESTful web service endpoints. In addition, we'll examine the tools that make Ruby productive, elegant and stable, like "Rake":, Ruby Unit, "rcov":, "flexmock": and "Cerberus":

We have a blast at these events, and we think you will too. Come check it out!

Jan 08 2007


CAS, SSO and Rails

I just finished creating a demo install of a suite of Single Sign On capabale Rails apps for a customer. We decided to go with CAS for the authentication management, largely because it is OSS but also because install is just dead easy (copy cas.war into the /webapps folder under Tomcat, restart Tomcat).

Likewise, installing the Ruby client for CAS was just as easy: ` >sudo gem install rubycas-client `. Once that was taken care of, I just had to configure the individual Rails apps to use CAS for authentication. According to the docs for the client, you just have to add some metadata to `environment.rb` that tells CAS where to go for authentication, and a filter to `application.rb` to launch the process. I found that there were a couple of really important things missing from the instructions, especially if you want to test locally.

  1. You have to include the following line in the environment file to get the CAS username to show up in request.username: `CAS::Filter.wrap_request = true`.
  2. Don't use `CAS::Filter.cas_base_url = "your_CAS_url"` unless you already have SSL set up and working. If you are trying to test against an non-SSL setup, it won't work becase CAS will automatically assume SSL for the validation step. Instead, use: `CAS::Filter.login_url = "your_CAS_login_url"` and `CAS::Filter.validate_url = "your_CAS_validation_url"`.
  3. Always supply the `CAS::Filter.server_name = "your_domain:your_port"` declaration. Without this, it kept using the app's domain but stripping the port on the redirect after authentication, thus leaving me with a 404 error after successful login.

That's not a lot of gotchas for such a great piece of functionality. I'll post more details as we roll the implementation forward and if we see any other issues, but for now, we're very please with how easy it is to get CAS set up and working with our multiple Rails apps. Go Yale!

Jan 07 2007



Found this on Martin's Bliki. Using rake instead of make or ant is our recommended approach for new Java projects. Until recently, the one drawback to this was losing ant's tight integration with Java. With JRuby advancing nicely, JRake will let us have the expressiveness of rake and tight Java integration.

Jan 05 2007


Monitoring Your Apps

It is definitely true that one of the things I miss most about Java is its wealth of monitoring tools for running apps. The monitoring console for Java5 is incredible, and gives you realtime insight into how your apps are performing. We've all been waiting around for something similar in the Rails space. I've recently started looking into FiveRuns (, and I'm very impressed. FiveRuns is a management console that spans all your infrastructure components; on our XServe, it is monitoring OSX system level information (basically, everything Apple's System Monitor tracks), two separate MySQL instances and our Apache instance.

From their website, it seems that you can also monitor JVMs, Oracle instances, JBoss, Tomcat, Linux servers, and more. Now, obviously, the thing that intrigued me most about their tour was the tease about being able to monitor Rails apps. Check out this screenshot for the tease. FiveRuns is going to be at the Rails Edge at the end of this month with a "special announcement", so here's hoping that this is the release party for Rails monitoring.

What's almost as cool is the way their app works. The monitoring console is a hosted app that received data dumps from a "Smart Client" you install on your server. All the information is pushed from your servers to their host, so no inbound tunnel is required. This is the same setup as 6th Sense, who does project development tracking through a series of "Agents" installed on developer and test boxes. It is very interesting to see the growth of the "smart agent" technologies for collecting information -- lots of tiny little sensors floating around your systems and reporting back to the mothership. Very Vernor Vinge.

Jan 04 2007


erubycon February 9-11, 2007

Justin and I will both be in Columbus, OH for erubycon. For us, 2007 is already shaping up as the year of Enterprise Ruby. We are seeing Ruby used for a broader variety of tasks, in all kinds of Enterprise environments. Rails is a given, of course, but also build automation, batch processing, Rinda, and XML processing. Our fellow speakers at erubycon can talk the talk because they walk the walk. I am looking forward to catching up on how they are using Ruby in the Enterprise.

Jan 03 2007


Moving to Mephisto

As you may haven noticed, we are in the midst of the annual site update. This year we will be running the site on Mephisto. If any old links that are important to you are broken let us know.

Dec 09 2006


Getting Cerberus and Rails 1.2RC1 to play nice

Now that the book is off to the copyeditor, I finally am finding some time to do a bit of house cleaning. I sat down yesterday to work through nine Rails projects with the following objectives:

  1. Make sure everything is configured correctly for continuous integration builds with Cerberus
  2. Update any code that is causing problems with Rails 1.2 RC1 or with Rails 2.0 deprecation warnings.
The deprecation stuff was surprisingly easy, just a little regular expression work in TextMate. As an aggregate, the nine projects have over 90% test coverage, so I was quickly able to verify that the fixes were correct.

Getting all the projects to build against 1.2RC1 in Cerberus was surprisingly hard. First, Cerberus itself does not work with RC1! I have submitted an ugly workaround for that if you are having the same problem. But the problem with Cerberus is one example of the more general problem: Code loading in Rails is tricky, environment-dependent, and has changed in some way in RC1.

Apparently, some plugins out there depend on eccentricities of code loading. Of my nine projects, six moved to RC1 with no trouble, and the other three cannot run on RC1 at all. What the three projects have in common is that they depend on a lot of plugins. Unfortunately, the errors are somewhat cryptic, and all different.

I see that JDD has had some problems with code loading in Rails, but for the most part I don't see others out there having this kind of pain. Am I just unlucky?

Nov 16 2006


Neologisms for pattern

Jim Weirich is here at the Rails Edge talking about design patterns. As he and many other people have pointed out, design patterns are language specific. In sufficiently expressive languages, many design patterns become library calls or disappear entirely. For example, does Iterator deserve to be a design pattern in Java? There's an interface for it, after all. Many design patterns have direct library representations in Ruby: Singleton, Observable, Enumerable, etc.

Quite a while back, Peter Norvig proposed some terminology to deal with the gradual disappearance of certain patterns:

  1. An invisible pattern is so much part of your language that you do not perceive it as a pattern. For example, "Encapsulation" is not a pattern in Java.
  2. A formal pattern has an explicit library or macro realization, e.g. Ruby's Observable.
  3. An informal pattern is not captured by the language.

Far too many pattern enthusiasts relish informal patterns, when we should be trying to convert them to formal or invisible ones.

Popular Tags