The last several months I’ve made a small but vital change in the way I look at controllers in Rails projects. Controllers never really sat all that well with me, and I couldn’t really put my finger on why. The problem is that controllers are a part of the web domain—they have one responsibility, and that is to send a response given a request. That’s it. Even with the (oversimplified) mantra of “Fat model, skinny controller”, which has its own problems I’m working through for another blog post, every Rails project I’ve ever seen has incorporated some amount of business logic into the controller. On top of that, it’s very common to see logic pushed down into the model (again with the “fat model” business) even though its got nothing to do with the problem domain, but some ancillary aspect of the business logic.
It’s late on a Saturday afternoon, and I’m cleaning all of my clothes out of what used to be my closet in my bedroom of my house, but where I’m now a guest who’s far overstayed their welcome. Surrounding me in various “to be donated” piles are dozens of T-shirts of failed startups, the detritus of broken dreams left floating long after the market sea has pulled their ships beneath its waves. More striking to me is that these scraps constitute the vast majority of my wardrobe—and the most recent portion of it, at that. “Maybe she’s right,” I think to myself. “I am terribly unfashionable.” In the keep-me pile I find one of my more recent shirts, a yellow striped number I seem to recall purchasing a year or so after my wife and I started dating five years ago. “Ex-wife” I tell myself, physically trying to shake the old nomenclature out of my head. More than simply unfashionable, I realize. I had long since quit caring about impressing anyone.
This is the brief story of how I became a cautionary tale.
(or, “How I made peace with my father and learned to love the enterprise”)
[Update: if you liked this post, please take a second and upvote it on HN]
As I write this, I’m sitting in my father’s TV-watching chair as my son plays with the various and sundry toys he’s accumulated over the holidays. Not that long ago I’d have regarded this scene as improbable at best, as my father and I rarely see eye-to-eye on much of anything, and haven’t for years. For a number of reasons, this is the first Christmas I’ve been to my father’s in quite some time, but chief among them is the persistent notion I have that while my father and I rarely agree, it doesn’t have to mean one of us is wrong. If there’s one thing being a parent has taught me, its that maybe Dad was right about a few things as well.
And if there’s been one theme I have kept seeing popping up in 2011, its the idea that more and more in the Ruby and Rails world have started noticing some of the problems in Rails. Steve Klabnik’s most recent post is the latest salvo in a long string of high profile Rubyists noticing that what we’ve been doing for the vast majority of applications isn’t working anymore.
So my latest resolution is to start blogging more, and as part of that I’m giving myself a new blog. I moved to Posterous a year or two ago, but I never really enjoyed the experience. Jumping on the bandwagon with everyone else, I’m giving Octopress a try. So far so good—it took me about fifteen minutes to set up. Next step is to migrate my DNS to DNSimple and get rid of Godaddy, and point everything at my heroku site for the blog.
I tried to migrate all my old posts from Posterous, but that was a great big fail whale for some reason (I keep getting 410-Gone for the http error; if you know what I’m doing wrong, drop me a line in the commnts.) I’ll have to migrate that stuff manually, I suppose—good thing I didn’t spend much time blogging in the last couple of years or I’d have a lot more work to do there.
Its Monday. Again. Where’s my Monday Morning Panic Attack? Oh, there it is. Again. Right on time.
I’m integrating AMQP with an app right now, and ran into a problem using
rails server to serve up the app for development purposes. The short version (see here and here for the longer versions) is that when integrating into a forking environment like Phusion Passenger, you have to jump through a few (relatively easy) hoops to initialize the EventMachine reactor that the AMQP gem uses.
I have my terminal set to spit out a quote from the unix utility fortune every time I pop open a new shell. This one came up a few minutes ago:
The Man Who Almost Invented the Vacuum Cleaner
The man officially credited with inventing the vacuum cleaner is
Hubert Cecil Booth. However, he got the idea from a man who almost
In 1901 Booth visited a London music-hall. On the bill was an
American inventor with his wonder machine for removing dust from carpets.
The machine comprised a box about one foot square with a bag on top. After watching the act – which made everyone in the front six rows sneeze – Booth went round to the inventor’s dressing room.
“It should suck not blow,” said Booth, coming straight to the
point. “Suck?”, exclaimed the enraged inventor. “Your machine just moves the dust around the room,” Booth informed him. “Suck? Suck? Sucking is not possible,” was the inventor’s reply and he stormed out. Booth proved that it was by the simple expedient of kneeling down, pursing his lips and sucking the back of an armchair. “I almost choked,” he said afterwards.
When you’re engaged in an endeavor that someone else has already tried, its important to remember that the details count. Small differences may seem trivial at first, but the smallest twist on an idea can make the difference between Friendster and Facebook. Timing can be the difference between MP3.com and Apple’s iCloud or Amazon’s Cloud Player.
Just because someone else did it first doesn’t mean you won’t be the first to do it right.
Look, we get it. Despite the ridiculous pain in most sectors of the economy, and despite the huge numbers of jobless people out there, things in the tech world are largely rosy. There are jobs galore. If you’ve got an opening demanding a hot technology like Rails and you’re based somewhere like San Francisco or New York, good luck filling it. I get at least three emails a week (in a quiet week) from a recruiter looking to fill a position. I love that. Its a great time to be a strong technologist.