Developer’s journal: devise, Rails 3, RSpec, and more

July 9th, 2010

I keep a text file open as I work, and when I learn something, or fix a bug, I make a note of that in the text file. I call it my journal. It’s pretty low-tech, but text search turns out to be a sufficient way to look up past experiences when I find myself thinking “this problem seems so familiar”. There’s another benefit too: I find keeping simple notes about what I’m doing—what problems I’m solving, what approaches I’m using, what’s working and what could work better—keeps me focused on my goals. It turns out learning a programming language or a web framework is not as hard as training your mind to solve programming challenges efficiently.

Here are some things from my journal: I’m working on a Rails 3 app right now, something I plan to flog and promote mercilessly in upcoming posts. I’ve encountered some mysteries for which there was no simple HOWTO information easily available via web search. I thought I’d share the answers I cobbled together:

  1. How to get RSpec and RSpec-Rails for Rails 3;
  2. How to make devise routing work with related nested routes;
  3. How to spec controllers that use devise to restrict access to logged-in users;
  4. How to get verify :method to work in Rails 3.

Read the rest of this entry »

3 languages

June 29th, 2010

I need to clarify my interests. I keep getting calls from recruiters who want to hire me to do Perl or database management. So, I am trying out an experiment in self-analysis by describing my enthusiasms as they relate to specific programming languages. I am currently interested in the web software applications of Ruby, JavaScript, and Clojure.

It isn’t all about programming languages. There are topics and concerns that span software development and computer science. But PLs are one great way to summarize one’s experience and efforts. And I’m a language nerd, so I like PLs as ends in themselves. So, here is my little essay on the 3 languages I like most right now, and, more importantly perhaps, what I want to do with them in the coming months. This is my summer of hustle, and this post is part prelude, and part wishful thinking, about all the things I’d like to tackle.

Read the rest of this entry »

Mustache support for Rails 3: template handler

June 23rd, 2010

I sure am glad I went to the Bmore on Rails hack night yesterday. I got some invaluable help from Paul Barry hacking together a working template handler for mustache in Rails 3.

Read the rest of this entry »

Mustache support for Rails 3: generator

June 16th, 2010

At RailsConf, Jeremy McAnally noted that no one had built a new-style Rails generator for the mustache template system. So I’m giving it a try. You can see my progress so far on github. I’ve forked the rails3-generator project started by José Valim and carried on by several contributors, and I’ve added just a little bit of support for mustache file creation in controller and scaffold generators. I was greatly helped by Paul Barry’s post on adding a Haml generator to the same project.

The next steps are to flesh out the generator templates and try to get a working mustache template engine. Mustache and Rails don’t officially work together yet. That’s a goal for mustache 1.0. I’m excited, however, about Martin Gamsjaeger’s promising implementation.

I’d like to see a gem that gives you complete Rails support for mustache: the template engine, generators, helpers, and documentation. I’d also like to see the gem work with Tilt, which claims to provide a generic interface to mustache already.

If you’re interested in helping, well… fork me!

My blog is godless communist bullshit

June 5th, 2010

Giles is right. As usual. In my recent post, I included a passage from Giles’ blog that I disagreed with. Except… Giles didn’t author that passage, Seth Godin did. Giles was just quoting it.

I’m sorry, Giles. I’m correcting my post now.

Nothing stings quite like announcing your own brilliant close reading and then discovering you weren’t reading closely at all. Actually, being accused of going to Harvard might sting more.

On Ruby monkeypatching and Clojure’s protocols

June 4th, 2010

I read an interesting article by Dave Fayram (kirindave) contrasting monkeypatching in Ruby with protocol extension in Clojure. The article compares two of my favorite languages, but I think it was unfortunate to present monkeypatching as the main way to “associate behavior and data in a flexible way.” In fact, Ruby has a number of safer ways to extend types and single objects. (And in Ruby even monkeypatching doesn’t have to be dangerous.)

Read the rest of this entry »

Beware someone selling you knowledge as a product

June 4th, 2010

Correction

As explained elsewhere, I committed a journalistic sin in this post by attributing a passage of text to Giles Bowkett when he was just quoting it. I’ve made changes to this post to correct that.

I’m going to do something different (for me). I’m going to post about someone else’s blog post (mostly). Giles Bowkett’s post College Is Bullshit, I Am The Future is ranty and provocative and funny, and worth reading, but I’m going to call bullshit on part of it (swearing is different for me too — wheee!) hopefully without seeming humorless or as though I’m missing the nuances of his as-usual gargantuan post. College does matter, as much or more than ever. An institution’s pedigree may not correlate to the intelligence or preparedness of all its graduates, but any good school should help its motivated students learn how to learn. And the new way to learn, which is expected to disrupt (as in disruptive technology) the college and university system, information products, is not an alternative to that system at all. It’s as much a life raft for a sinking ship as Giles argues colleges are. The best way to prepare for the future is to learn how to learn. You don’t have to go to more school to learn how to learn, but there are few better places to do it.

Read the rest of this entry »

My summer of hustle

June 1st, 2010

The mojitos have been drunk, the neglected lawn work is mostly completed — Memorial Day is over, and now our de facto summer in the United States begins.

I’m writing this post more for myself than for you, generous reader. I hope you forgive my brief use of the weblog’s confessional mode. I need to make an official announcement that I have work to do. Inspired by Amy Hoy’s description of her year of hustle, and by Giles Bowkett’s long post about what he did when he got fired, I’m launching an all-out effort this summer to build and ship some code.

I wandered into web development because it was really cool. It was the next major mass medium, and it did something new: it made documents easy to distribute to the world. That was 15 years ago. I had no contemporary programming experience. I had a newly-minted social sciences degree and a lot of curiosity. I started in production and management and steadily got more and more into software development at a series of failed start ups. Now, in my mid-30s, I finally feel code literate. I also feel like I know something about the realities of writing code and trying to sell applications and content online. But what do I have to show for myself?

Those start-ups are gone. The project management work I did at an interactive agency? Zzzzzzz. I’ve built some decent sites lately, but their futures are uncertain, and my best work for them, I can’t really write about it because it belongs to my clients.

Thirty-six is a funny age in this business. It used to be old. Now, there are plenty of 40-ish and 50-ish people in the industry. But they’re visible. They’ve made a mark. My suspicion is that a lot of other people who didn’t make a public mark are finding it hard to continue doing decent anonymous work.

The solution is to make your mark by releasing something valuable into the world. And with open source having conquered the world, it’s never been easier to do this. So, like my assistant professor wife, I find myself facing a publish-or-perish moment.

Hence my plans for a summer of hustle. This week I’m getting geared up for RailsConf, but I am also reviewing my interests, my passions, looking for inspriation. It’s time to overcome my misgivings — that I don’t know enough, that I’ll embarrass myself, that no one will care about what I produce. Because I’m getting too old to live on work-for-hire.

Not that I’m counting on making money, directly or indirectly, from what I release. I’m not thinking about bread alone. There’s a point when the spirit demands more. It seems to me there are intangible benefits to contributing to the global codebase. More human contact, certainly, and with more intelligent and creative humans. There is also the satisfaction of creation, of making something purely for its own merits.

Although I’d sure like it if it did bring me suitcases filled with cash.

So there, I’m committed. No pressure.

My asynchronous concurrency talk at May Capital Area Clojure Meetup

May 31st, 2010

I was lucky enough to present a talk about asynchronous concurrency in Clojure (and JavaScript and Ruby as it turned out) on May 27th in Reston. Thanks to FGM and Matt and Russ for organizing and hosting the Capital Area Clojure meetup.

I have the slides available for review from scribd below. There’s plenty about agents and futures in there, plus a look at Evented IO in Node.js and tuple spaces with Rinda. After the break, I also offer a few observations about the content in light of questions asked in the meetup and my own reflections.

Asynchronous concurrency in Clojure and a few other languages

Read the rest of this entry »

JSConf Epilogue: we <3 Mozilla Dev Center

April 19th, 2010

Just a quick note: at JSConf, Chris Williams, John Resig, and others called on all JS bloggers to pimp MDC as much as possible. And they’re absolutely right: we should try to push it higher in the search results pages for JavaScript by giving it lots of inbound links. So, here’s my contribution. Go go, Mozilla!