Kerry Buckley What’s the simplest thing that could possibly go wrong?

1 January 2008

Happy New Year

Filed under: Software — Kerry Buckley @ 6:19 pm

JanusSo, that’s 2007 over with. Is it just me getting old, or did the past year go by even quicker than normal?

Amongst other things, 2007 was (for me at least) the year of Ruby. Obviously Rails had already been around for a while, and the language itself even longer, but they both seemed to be popping up all over the place last year, and gaining acceptance where they had previously been ignored as not mature or “enterprisey” enough. It’ll probably still be a while before large companies look at Ruby and Rails in the same way they currently look at Java and J2EE, but at least in my little corner of a large company I was able to spend the whole year writing Rails apps. It doesn’t look like there’s going to be any slacking of the pace in 2008 either, with the last few weeks of 2007 seeing the release of Rails 2.0, RSpec 1.1, Ruby 1.9 and JtestR (the last of which should be cool for Ruby people still stuck in a Java world).

It was also the year of ‘social networking’ websites in general, and Facebook in particular. Halfway through the year they introduced their developers’ API, and the web was awash with people praising their openness. Over the following months people started to realise that that ‘openness’ was very much one way, intended to get your applications running on their platform rather than allowing users to expose their data on the Web, and much of the shine wore off. Of course, most of us still use it now and again (if only to play Scrabulous), and there are a few signs that they’re starting to open the door to the Web ever-so-slightly in the other direction, so we’ll see what happens. There’s also OpenSocial to keep an eye on, of course, with Google so far managing to stay just on the right side of the good/evil line (all-seeing eye notwithstanding).

At the lighter end of the social networking scale, the star of 2007 was undoubtedly Twitter. Never has something so simple and apparently pointless been so intriguing and useful. Their business model (at least in the UK) is still a mystery though.

Some would say that 2007 was the year when Agile Software Development finally crossed into the mainstream. Unfortunately I tend to side more with Simon and Gus, and call it the year of compromised agile. It seems that for many large companies ‘agile’ has just become another buzzword. They talk about ‘enterprise scale agile’ and introduce a few of the easier, non-technical practices (daily stand-ups, retrospectives and so on), and put off making the real changes that are required for a truly agile organisation (co-located self-organising teams, daily customer involvement, devolution of decision-making, genuine focus on business value, an emphasis on technical excellence, test-driven development etc), while persisting with anti-agile behaviours such as outsourcing development, big up-front design, ivory tower architecture and fixed time, scope and budget. Baby steps are great, but there’s an implicit assumption that you take lots of them, instead of a few large ones.

Last but not least, 2007 was, of course, the year of the lolcat!


So what does 2008 hold in store? Unfortunately I didn’t get a crystal ball for Christmas, but here are a few guesses and hopes.

Will 2008 really be the year of Erlang? It seems to be building up the same kind of following (amongst many of the same people) that Ruby had 18 months ago, so who knows? It’s an interesting language, but I still find that the syntax grates.

Perhaps this will be the year when everyone finally realises that ‘Web 2.0’ has become so overloaded as to be meaningless. Sadly, even if that happens we’ll probably just see the buzzword bandits start calling something ‘Web 2.1’ or ‘Web 3.0’, so that’s a battle that’s never likely to be won.

Finally, could it be the year of OpenID and OAuth? If it weren’t for my poor security practices when it comes to personal site registrations, I’d have no chance of remembering account details for the myriad sites I’ve registered on, so wider adoption of OpenID would be nice. Similarly, it’s a pain finding and adding friends in yet another ‘social network’ application. I don’t really want to be handing out my GMail password left right and centre, and OAuth would (amongst other things) provide a neat way to request friends lists from other sites (and of course using OpenID would make it easier to identify people). Personally, I’d prefer it if everywhere just exposed my friends list publicly like Twitter does, or at least gave me that option. If they all used FOAFXFN, so much the better.

Anyway, I ought to post this while it’s still New Year’s Day. Whatever technologies 2008 has in store, I hope it’s a good year for you.

[tags]ruby, rails, rspec, jtestr, facebook, agile, enterprise, compromised agility, lolcats, erlang, new year, 2007, 2008, web 2.0, openid, oauth, foaf[/tags]

19 December 2007

The Neglected Practice of Iteration

Filed under: Agile — Kerry Buckley @ 9:40 am

“It’s not iteration if you only do it once.”

I’ve already mentioned Jeff Patton’s XPDay keynote, where he talked about the importance of working in iterations (as opposed to increments). Jeff has now written a column, The Neglected Practice of Iteration, on StickyMinds, making the same point (but without the music!)

Excellent stuff, and well worth a read. I suspect most people who claim to follow an iterative development process are prone to lapsing into an incremental mentality – I know I am.

[tags]Jeff Patton, iteration[/tags]

18 December 2007

“You have to declare the controller name in controller specs”

Filed under: Rails,rspec,Ruby — Kerry Buckley @ 9:35 pm

For ages I’ve been getting an intermittent problem with RSpec, where occasionally I’d see the following error on a model spec:

You have to declare the controller name in controller specs. For example:
describe "The ExampleController" do
controller_name "example" #invokes the ExampleController
end

The problem seemed to depend on which order the specs were run in, and for rake it could be avoided by removing --loadby mtime --reverse from spec.opts. It was a real pain with autotest though, and today (my original plan of “wait for RSpec 1.1 and hope it goes away” having failed) I finally got round to looking into it properly.

It seemed that the error was being triggered by the rather unpleasant code I wrote a while ago to simplify testing of model validation. Digging into the RSpec source to see what was happening, I found that that error message only gets returned when (as you’d expect) you don’t declare the controller name in a controller spec (specifically in an instance of Spec::Rails::Example::ControllerExampleGroup). The code that decides what type of example group to create lives in Spec::DSL::BehaviourFactory, and according to its specs, there are two methods it uses to figure out what type of spec it’s looking at:

it "should return a ModelExampleGroup when given :type => :model" do
...
it "should return a ModelExampleGroup when given :spec_path => '/blah/spec/models/'" do
...
it "should return a ModelExampleGroup when given :spec_path => '\\blah\\spec\\models\\' (windows format)" do
...
it "should favor the :type over the :spec_path" do
...

I began to suspect that the problem was caused by the fact that my specify_attributes method wasn’t declared in a file in spec/models, so I thought I’d try specifying the type explicitly. So instead of this:

describe "#{label} with all attributes set" do

I changed it to this:

describe "#{label} with all attributes set", :type => 'model' do

Sure enough, it worked! Not sure whether anyone else is likely to see the same problem (unless they’re foolish enough to use my validation spec code), but hopefully if you do, a Google search will bring up this post and it might point you in the right direction.

26 November 2007

Rails Envy’s take on the werewolf question

Filed under: General nonsense,Rails — Kerry Buckley @ 10:18 am

This clip [MP3, 57s] from a Rails Envy podcast made me laugh. It’s referring to Charles Nutter’s recent musings on whether werewolf is killing the conference hackfest.

Incidentally, how often do you get the chance to Google for “nutter werewolf”?

[tags]rails envy, werewolf[/tags]

24 November 2007

[BarcampLondon3] Message-Oriented Architecture (Matt Bidulph, Dopplr)

Filed under: Software — Kerry Buckley @ 3:15 pm

HTTP not ideal for asynchronous stuff (“Are we nearly there yet?” “No.” “Are we nearly there yet?” “No.” “Are we nearly there yet?” “No.”). Message-passing architecture is better (“Let me know when we’re there” … “We’re there!”).

Also useful for clusters, multi-core machines etc.

Erlang (also Scala, Haskell, E etc) are becoming interesting because they operate using messages. Not that different to pure OO. No shared state. Scalability doesn’t come for free, but it’s much easier.

Spread, MQ, JMS etc: publish and subscribe. Stick a message on a topic or queue and any subscribers receive it. Allows very loose coupling. One-to-many, with publisher not needing to know about subscribers.

Comet allows a connection to be held open between browser and server, rather than having to poll.

Jabber can be used to return future results for a search (for example). “There will always be more pictures of kittens.”

Worker queues remove expensive calculations from synchronous tasks (eg calculating Dopplr coincidences does your own immediately, and queues a job to calculate coincidences for all your contacts).

Using JQuery you can create your own events in a browser. Becomes more like traditional GUI programming.

Extreme late binding: combine data and code in application (eg javascript and data in browser – mashups).

The Internet is the computer.

First question: “How does Dopplr work?” :-)

Interesting point about hiring: go for the people who are good at the cool stuff (Erlang, Haskell, etc), because they’ll probably be really good at the workaday stuff too, and are obviously interested in the field.

[tags]barcamplondon3, messaging, erlang[/tags]

[BarcampLondon3] Caja/OpenSocial (Ben Laurie)

Filed under: Software,web,Web 2.0 — Kerry Buckley @ 1:55 pm

Caja compiles Javascript into different javascript, allowing you to put untrusted gadgets in trusted container pages (eg OpenSocial). Removes potentially evil code (eval etc), and passes in an object representing the global scope (document etc).

Ben’s writing a Caja wrapper for OpenSocial. Lots of hairy stuff with closures wrapping callbacks in functions, then wrapping the response in more functions. I haven’t really looked at OpenSocial yet, so some of this is flying merrily over my head.

[tags]barcamplondon3, caja, opensocial, javascript, gadgets[/tags]

[BarcampLondon3] Tom Morris on GRDDL

Filed under: Software,web — Kerry Buckley @ 11:58 am

Screen-scraping HTML is evil. APIs are better, and can return structured XML, JSON or even SOAP (everyone laughs at the latter!)

If page is marked up semantically using microformats, an XSL stylesheet can convert it into RDF. Put the stylesheet on a profile page and link to it from the HTML (<head profile="...">), and triplr can generate triples from it in various formats. This can then be parsed using SPARQL.

The end result is custom microformats, possibly specific to your site, or something like class="nsfw" to mark up stuff that’s not safe for work, which Tom uses on his blog.

GRDDL allows

[tags]semanticweb, grddl, barcamplondon3[/tags]

21 November 2007

[XPday 7] The Informed Coding Dojo

Filed under: Agile — Kerry Buckley @ 10:47 am

This session was run by Karl Scotland & Johanna Hunt. I helped run a coding dojo at work for a while, until it just kind of fizzled out, so I was interested to see how someone else approached it.

The twist was that the dojo was run using Inform 6, which is a domain-specific language for writing text-based adventure games (“You are in a maze of twisty little passages, all alike…”). this meant that none of the participants were familiar with the language, which forced us to take very small steps rather than quickly hacking together large chunks of code based on experience.

The baby steps thing seemed to work quite well, helped by the strict five minute pair rotations (driver back to audience, navigator to driver, audience member to navigator). Those rotations weren’t quite like the way we used to do it (we never really settled on a fixed policy, and experimented with ping-pong pairing, swapping both people out of the pair at once and increasing timeslots to ten minutes). We also weren’t as strict about banning suggestions and comments from the floor – stopping that seemed to help avoid circular conversations and let the pair get on with coding, although the unusual language may have helped here too. It was very frustrating though when you could see an mistake that was causing compilation errors, but the pair hadn’t seen it yet.

As it turned out we only got about halfway through the tasks we’d been set. It was quite an enjoyable hour and a half, but I’m not sure how much I learned.

[tags]xpday, coding dojo, pair programming, inform6[/tags]

[XPday 7] Jeff Patton Keynote: “Embrace Uncertainty”

Filed under: Agile — Kerry Buckley @ 10:01 am

Jeff gave an entertaining presentation on strategies for coping with the inevitable changes that take place during a project release. The talk was punctuated with blasts of music from various artists filling in as personas, from Mel B as a developer capturing user stories (“So tell me what you want, what you really really want”) to Johnny Rotten as an experienced agile practitioner (“Don’t know what I want, but I know how to get it”).

Many companies are now adopting agile methodologies such as Scrum to jump on the agile bandwagon, and are looking for consultants to provide training, and to come in and tell them all the answers to their problems. Because they are looking for prescriptive processes that they can put in place for people to follow, we are starting to see ever-more complex systems for things that were previously considered simple tasks (such as prioritising user stories). This is what Fred Brooks referred to in No Silver Bullet as ‘accidental complexity’ – complexity in the activities around writing software, rather than in the domain of the business problem you’re supposed to be solving.

Is this process rigor, or rigor mortis?

We have forgotten the meaning of iteration, and are working in increments instead. We are expecting an ‘iteration’ to contain a number of fully-completed stories, which we can then forget about and move on to new features. The problem with this is that when we deliver those stories, the customer is not entirely satisfied, and we have to introduce new stories to refine the design. This in turn affects our velocity, because we find ourselves spending more and more of our time enhancing features that we thought were done.

It’s not iteration if you only do it once.

Alastair Cockburn has suggested a ‘three story’ approach, where you make the iteration explicit by putting two additional cards behind each user story – one to fix the original story, and another to fix the second attempt. Jeff’s only concern with this was that people might take it too literally, doind a seond rework even if the customer was already happy, or stopping after the third story when the feature clearly wasn’t really done.

Along with YAGNI, Jeff suggested adding YAGRI (you ain’t gonna release it). This was to remind us that it’s OK to present non-production features to the customer, in the knowledge that they won’t be released until they’ve been iterated into a deliverable state. To me that seems OK for shrink-wrapped software and other things where iterations aren’t released, but I wonder how it applies to web applications, where it is becoming the norm to release small changes frequently (perhaps multiple times per iteration). In that case, we’re used to making the assumption that everything is always releasable. Maybe the answer is to separate new, ‘beta-quality’ features from the main body of functionality.

Three strategies for coping with the inevitable uncertainties in building a release were described:

Follow the Money

Prioritise the business goals. By focussing on the things with the highest value to the business you restrict the user constituencies which you should target first, and hence identify the highest priority user stories.

Don’t Choose the Solution Too Early

Focus on the user goals rather than the perceived requirements on the application, and consider and discuss alternative ways of meeting those goals. It may be that a simpler or cheaper implementation than the immediately-obvious one may be sufficient.

Build up Quality in Iterations

Sometimes the customer really does need everything to be implemented before the product can be released. In this situation, you can start by implementing stories to a very basic, almost prototype, level. You then build up the quality iteratively, using feedback from the rough-cut implementations to guide you. One way of doing this is to grade each story (eg A+ down to F, plus I for incomplete), then have a ‘passing grade’ at which the feature is considered fit for release.

One consequence of actually iterating, rather than using ‘iteration’ as a label for an incrementl chunk of functionality, is that there’s a lot more work for the customer (or product owner, or whatever you want to call them). They need to work frequently with the developers to evaluate each version of a story’s implementation and describe the changes necessary to make it fit their needs.

The summary of the talk was to question common practice and to trust your instincts. As an aside, that leads into a rant I keep meaning to get round to, on the subject of people who say that a particular behaviour “isn’t agile”, because it doesn’t fit the letter of their particular methodology of choice. Watch this space.

[tags]xpday, iteration, agile[/tags]

14 November 2007

Weird Rails bug

Filed under: Rails — Kerry Buckley @ 9:21 am

I Spent some time yesterday tracking down a bizarre bug which was causing some of our Selenium tests to fail. Watching the browser running the tests, I could see that occasionally a page would fail to render, with an “invalid argument” error and a stack trace. The line in question was an <%= end_form_tag %> in a layout. The strange thing was, it didn’t display the same behaviour when I ran the single failing test on its own, or when I viewed the page myself.

Or at least, I thought it didn’t. Because it seemed intermittent, I tried reloading the page a few times, and sure enough, the error appeared. Once. Then the page reloaded successfully six times, before failing again. This was completely repeatable – six times OK; one stack trace. Regular as clockwork.

Completely stumped, I thought I might as well at least replace the deprecated <%= start_form_tag %> … <%= end_form_tag %> with <% form_tag do %> … <% end %>, and lo and behold, that fixed it.

Unfortunately, I have no idea why. An imaginary prize to whoever can explain it!

« Newer PostsOlder Posts »

Powered by WordPress