Rails and Cucumber – The Benefits of Using Cucumber in Your Next Ruby on Rails Application
Friday, May 21st, 2010
Ever wonder what the appeal of Cucumber is? Wonder if you should employ Cucumber to help develop your next Rails apps? Is it worth the time, effort and extra steps involved? My vote is a hearty “yes”. And here’s why:
First, Cucumber forces you to SLOW DOWN. It forces you to stop and think. To plan. Instead of diving into things at the granular level (the nitty gritty of models, controllers and views), instead you have a planning point and can focus on the big, important things that really matter:
- What is the goal of the app?
- What should it do?
- How should it react to the user?
- In what situations should a feature present itself?
Second, Cucumber gives you a birds-eye, top-down view of your application. It keeps you centered on your clients’ goals. To be fair, other BDD (Behavior Driven Development) tools do this as well, but Cucumber’s plain English and simple syntax make it unique.
The Link Between Man and Machine
Cucumber forms the bridge between everyday, conversational English (as communicated by your client) and the app itself. For this reason, I think Cucumber is brilliant.
This reminds me of something the late, great Terence McKenna said about artificial intelligence…
The realization that when human beings think clearly, the way they think can be mathematically defined. This is what is called “symbolic logic” or “boolean algebra”. Words like “and”, “or”, “if” and “then” can be given extremely precise, formal mathematical definitions. And because of this fact – that clear thinking can be mathematically formalized – there is a potential bridge between ourselves and calculating machinery.
If that’s not heavy enough, he goes on:
Because, indeed, calculating machinery is driven by rules of formal logic. That’s what programming is. Code that does not embody the rules of formal mathematical logic is bad code. Unrunnable code. So, as I say, this may seem a subtle point, but for me it had the force of revelation.
Because it means good thinking is not just simply aesthetically pleasing or concurrent with the model that generates it. Good thinking – whether you ever studied mathematics for a moment or not – can be formally defined.
This, to me, is what Cucumber is all about. It helps drive good thinking.
If it’s true that you should “measure twice and cut once”, Cucumber makes an excellent yardstick.