I am Paul Wilson; Mere Complexities Limited, sells my consulting, coaching, and coding services. I am passionate about Agile, particularly Test Driven Development.


Fluent interface for numbers Kata

Taking the lead from Kevin Rutherford, I’ve had a crack at Mike Feathers’ numeric literals kata in Ruby. The idea is to allow the following sort of thing:-


    assert_equal 24, twenty.four  
    assert_equal 2100, two.thousand.one.hundred   
    assert_equal 1019000, one.million.nineteen.thousand 

  

My solution (with tests, obviously) is here. Mike poses two questions

What qualities does a grammar need to have to create an embedded DSL which doesn’t allow nonsensical constructs?

In my example I couldn’t be bothered: seven.eleven evaluates to 18, and I don’t particularly care. A solution that takes care to enforce a strict grammar goes against the grain in Ruby, in my opinion.

If you really need to be strict then you’d probably be better going down the External DSL route, rather than implementing an Internal DSL in Ruby.

What is the minimal number of classes needed to implement it?

I went for zero. Well – kind-of. I just added methods to Object and Number. That’s the nice thing about Ruby: you don’t need that much code. Steve Yegge would be pleased.

Labels: , , ,


“Agile” – oversold, under-delivered, and over here.

Gordon Ramsey’s Kitchen Nightmares is an excellent programme about consulting and software development. Gordon Ramsey visits a failing restaurant and occasionally turns them round. It’s never one problem. A failing restaurant is typically failing at all levels: the cooking is sub-standard; management is lax; orders are badly organised; the menus are badly planned; the waiting staff are surly; the accounts are a mess. Gordon Ramsey, Michelin star chef, understands the importance of all the factors.

So, cooking is not the only factor in the failure or success of a restaurant. But it is essential. Cooking and serving quality food is what a good restaurant is about: it is at its core; it is its identity.

Clarke Ching is pissed off. He believes the “Agile Community” is spending too much time and effort worrying a about technical matters, while the key to success is concentrating on marketing and negotiation skills. I do believe these things are important, necessary even. If I didn’t I wouldn’t have done things like run, organise and arrange courses and sessions on working with resistance and team dynamics.

So, coding is not the only factor in the success or failure of a software project. But it is essential. Delivering tested features is what software development is about: it is at its core; it is its identity.

As Brian Marick says, its worse than Clarke thinks. As “Agile” is being more successfully sold at the senior level I’m seeing, and hearing about, a worrying trend of over-selling and under-delivery. Corporate executives are being persuaded to give “Agile” a chance, and “Agile” is being foisted on teams that lack the passion and skills to deliver on the promise.

We’ve overreached – it’s time to pull back and regroup to concentrate on building, teaching, and improving the core skills and techniques we need for successful delivery.


Rails prepares for Ruby 1.9

I was flicking through the Rails 2 release candidate code and was vaguely amused to find

  unless respond_to?(:send!)
    # Anticipating Ruby 1.9 neutering send
    alias send! send
  end

(In Ruby marking a method as private is more of a hint than a command. You can get round it by using Object#send – up until now. One of the Ruby 1.9 changes is that send won’t work for private methods – you need to use send!.)


subscribe here subscribe

About me

picture

Conference

Scotland on Rails Organiser

Previous blog posts

Blog archive

Other links: