A quick heads-up to two brief speaking engagments I’ve got coming up on the horizon.

First, I’ll be talking about software to tell stories with at the London Techa Kucha night on 25th July that Steve and Tom are running. That’ll be a radio-edit of the talk I gave at Reboot, more or less.

Then, I’ll be talking at LRUG on August 8th, looking at how as a Rails developer you can work effectively with front-end designers and client-side developers, and how you can keep the integrity of your front-end code at the same level as the back-end.

Come along if you feel like it. And if you found out about these events through the blog, do say hi.

One thing most web applications need is a static page template. Now, whilst the page content might be static, the template itself might need to be dynamic – either because it’s going to change in future, or because you’ve got dynamic user information that appears in the tempalte.

So the most obvious way around this is the static controller. Dead easy, this: generate a new controller called static (or whatever you want). Then just write views for it named after pages you want. For instance: your about.rhtml file can contain all your “about” information. Then, when you hit up /static/about (to use the default routing), you get your static content, without having to make a whole page from scratch in public_html. You could even write a new 404 page on this controller.

All that remains, once it’s working, is to write some dedicated routes, and then the “static” controller can be hidden from existence – just route /about to :controller => "static", :action => "about" and you’re done. No need to write any controller logic at all!

Going on from there: one view I’ll always add to that template is the “foo” action.

So: when you’re mocking up a page, you’ll probably use lots of dummy links. Everyone expects this, because it’s obviously just a flat mock. But when you mock up an application, and show it to stakeholders in a working state, they click on things, and wonder why they get ActionController exceptions when it breaks. Also, they wonder why the link that breaks stuff is always /foo.

Obviously, it’s because I’ve left link_to "/foo" all over the shop. Have no fear: the easy way around this is to route /foo to :controller => "static", :action => "foo", and then write a static page called foo.

When you do this, the page should explain that it represents functionality that hasn’t been added yet, but will be added soon, and that the developers haven’t forgotten it.

This (from experience) reassures stakeholders that the thing that is not working will be working soon. It also means that when they do find “grey screen” errors, it either means that something’s genuinely broken, or it means that the developers really have forgotten something. Time to update that link to point to foo.

It sounds trivial, but it turned out to be an effective communication of diligence on the developer’s part, and saved much time in meetings explaining that “yes, we’re working on that”. Consider it, next time you’re developing for external stakeholders.

Rails and Hypercard

22 December 2005

Gavin mentions the idea that Ruby on Rails might just be the new Hypercard – something I may or may not have discussed with him.

I think he’s right. After one of the London Ruby User Group meets, someone commented that all Rails really needs now is a killer easy-front-end for page layout, or an IDE for apps of some form, and it could really hit the jackpot. I immediately thought of Hypercard; it had the requisite simplicity, grace, and convention, and would be nicely suited to Ruby (just as it was to Applescript).

I’ve mentioned Hypercard before on this site. It was pretty formative in me finding a way I could program computers that wasn’t necessarily reams of code, of first making me aware of UI design, and of making programming fun. Rails has had a similar effect, properly kick-starting me into OO programming, and finally making me understanding and appreciate scripting languages.

The speed of gettings things working, that’s what matters. Not finished – finished might be a long way off – but you’ve always got something to show for your labours. That’s why I like it.

project.ioni.st on storing sessions in your db. Succinct, handy, and goes straight on the “do not lose!” pile.

OK, so maybe I was a little hasty with my earlier post. We are emphatically not all developers now. The hyperbole ran away with me, and I apologise for that. But there was a nugget of truth in there.

If the Rails-revolution (and that includes all those things which perform similar functions to Rails, even if they themselves are not rails) has a real-world analogue, it’s that of the far eastern bespoke tailors. You see their ads in the papers; they fly over to London for fittings in hotels, and then make a bespoke suit for you in their workshops back in Hong Kong. You end up paying the price of a decent off-the-peg suit (about £200) for something tailored to you. Of course, it’s not quite Saville Row, but it’s still a darn sight better than a generic off-the-peg model.

And this is what the rapid-development-frameworks give to small businesses.

A small business wanting to serve the global market might consider, say, an online shop as part of its web presence. A small, local web-development firm are contracted to build one. A long while ago, said web shop built a fairly substantial (and customizable) online store. They now use this work as a basis for future stores – pull another copy off the shelf, add a few tweaks, and serve to client. To create something uniquely tailored to the client’s needs would take a lot of time – and the client, being a small business, can’t afford the time a bespoke product takes.

So they receive delivery of a store that works, but has quirks that they could do without, features they don’t need, and might even lack features that could save them time; instead, they implement workflow-based workarounds to those missing features.

What the new frameworks do is put bespoke products (especially small bespoke products) within reach of small businesses. A small web-development firm isn’t going to be overworked, or take too long, to start from scratch and create a product that is 100% suitable for the client. The client will be more productive as a result. It’ll probably be a better product, too, as the product will always be built to current standards (instead of being last year’s model, dolled up).

Of course, in this new bespoke-economy, there will still be successful web-development firms who continue to serve up the old, 90%-suitable, off-the-shelf product. They might get away with this for a while, but not forever, because the bespoke economy serves everyone better – developers get the chance to constantly be creating new things; clients get the product they’ve always wanted.

So we’re not all developers, we’re just all in a position to get bespoke development at off-the-peg prices (or less). I mentioned ‘software scaling down to a userbase of one’. It’s not that this is possible – it always has been – that makes these new development frameworks exciting, but that it’s suddenly become very, very viable.

Why should it scale?

24 October 2005

The big question around Rails: does it scale?

I say: forget that. Ask this instead: why should it scale?

Rails empowers the lowliest user or homesteader to create applications faster, at a lower cost than ever before. You may have an application that does 75% of what I want to do – but given that Rails puts t even closer to 0 it’s probably be faster for me to start from scratch than it is to try and adapt yours. That way, you have a perfect personalised solution, and so do I. If we looked at our code, they might even resemble each other a little. That’s survival of the fittest, isn’t it?

More and more users will become programmers as the tools, the middleware, the software-to-make-software gets better. Ning is the beginning of this. Users don’t need a generic solution; they’ll all be rolling their own. Software will become more discrete – hell, it’s going to become discerning. The tools we use are very personal; in an ideal world, they’d all scale to a userbase of one.

I guess that we’re all developers now.

A few days I linked to Dema’s tagging mixin for Rails. In, well, about half an hour over the past two days I implemented it into a project I was working on – first into the models, then into visualisation. The interface will come last (though of course, that doesn’t mean it’s not getting a lot of thought right now).

One problem I ran into was that whilst I could tag away with new tags, adding an already-extant tag to a data object didn’t work – it threw an exception error. In the end, I found this was down to my join table – the tags_things table that assigns tags to thing objects. The thing was, as with most of my tables, I stuck an auto-incrementing id column into it. This was really a stupid idea and not in any way necessary (though in all the other tables, it is fairly appropriate). The moment I just left it with two columns, tag_id and thing_id, it all worked fine.

It’s a nice mixin, by the way – makes searching by tag dead easy and it’s fairly lean. Saved me reinventing the wheel, that’s for sure.

Fun with Ruby

19 August 2005

Gosh, I’ve been busy. Still, in between evenings out and work, I’ve been starting work on a fairly large personal project, which (unless I encounter a colossal brick wall) be written in Ruby, with the Rails framework playing a large part. So far, despite some hiccups, it’s been very pleasant; a fair amount of headscratching (in part down to my unfamiliarity with the langauge and its at-times-bonkers syntax, and in part down to working out just what I wanted to do), but every breakthrough has been delightful. A bit of trial-and-error, and then, suddenly, boom: I’ve got a whole new piece of functionality working with minimal code. I’m enjoying the langauge a lot – it’s reminding me of what I’d learned of Python a fair bit, but with some interesting twists. Particularly a fan of the idea that it’s a language that’s very understandable when spoken aloud, to the point of suggesting that methods with boolean outcomes should end in a questionmark, and that destructive methods should end with an exclamation mark. That’s fun.

More on this mystery project later, perhaps; I’m hoping it could be moderately big.

“The games press is often painted as corrupt, lazy and – as I mentioned – fundamentally stupid. This is because we tend to be corrupt, lazy and fundamentally stupid.

It’s not entirely our fault.”

Kieron Gillen has put up a full transcript of his talk from Free Play, a conference in Melbourne. In it, he explains to independent developers how to leverage the power of the gaming press – who, after all, really care about indepedent developers, whatever it may look like from the outside. It was probably a great talk. It’s certainly a great piece of writing, if only because it clearly explains the hectic, rushed, pressurized world that is magazine publishing to an audience who – whilst they might not understand publishing or journalism – certainly understand hectic, rushed, and under pressure. Well worth reading.

Bah

07 August 2005

So much for the success with Ruby on Rails detailed in the last post. Everything was going fine until I tried to create a scaffold. At which point I get a nasty little MySQL error:

Access denied for user ''@'localhost' (using password: NO)

So basically, even though I’ve defined all the database settings correctly in the database.yml file for the application, it’s trying to connect without a username or password. And as such, quite rightly, is failing. I’ve reinstalled the mysql gem, I’ve tried configuring the database.yml file to connect as root; none of it works. Bit frustrated – I can’t see that I’ve done anything wrong, but it’s just not working. I’ve also tried users with both old and new password hashes, and that hasn’t helped either. Anyone got any ideas? Anyone? Lazyweb?