MisBehave 0.1: Oslo’s MGrammar for BDD Executable Specifications

Posted November 9th, 2008 by Claudio Perrone

While people are still debating about the reasons behind Oslo, the forthcoming modeling platform officially disclosed at PDC a couple of weeks ago, I thought it would be useful to share with you how, this weekend, I used MGrammar to parse plain text stories and scenarios using the Behavior-Driven Development (BDD) language originally devised by my good friend Dan North.
One of the main ideas around BDD is that we can adopt a simple language for expressing business requirements that is ubiquitous among “customers” (business analysts), testers and developers.
At the simplest level, a story may be expressed using this template (emphasis on bold is mine):

Story: <title>
As <role>
I want <feature>
So that <business reason>

In other words, a customer may write something along these lines:

Story: View music chart
As a music fan
I want to browse a list of popular songs
So that I can be motivated to buy something from the catalog

One of the immediate benefits of using this convention is that high-level requirements can be described and manipulated consistently and succinctly.
I’m particularly fond of the So that step: if well written, it often highlights the actual customer needs.
Once a need is identified, it becomes much easier for the development team to find further (and often cheaper) alternatives to the requested feature!

In the example above, “browse a list of popular songs” is the request, but being “motivated to buy something from the catalog” is the actual need. Can you imagine other features that would motivate customers to buy more? I certainly do.
The lesson here is that, almost invariably, customers request a longer antenna when they actually need a better reception. Trust me, this kind of deliberate creative thinking on finding alternatives can save you days, weeks, or even months of work.

Identifying the need is so important, in fact, that others proposed the following alternative convention, so that you can force users to put the reason of the requirement at the beginning:

In order to be motivated to buy something
As a music fan
I want to browse a list of popular songs

Are you still with me? Good. Let’s move on and discuss scenarios.
Differently from conventional, “fully dressed” use cases that I used years ago, a user story is usually written on a small card which acts as a placeholder for a subsequent conversation with the development team.
When the conversation takes place, the team would ask the customer questions such as: “what do you mean by that exactly?” To express and clarify the details of each story we write down a few scenarios:
Here, BDD can help us again with another template:

Scenario: <title>
Given <some initial context>
And <some more context>

When <some event occurs>
Then <ensure outcome>
And <some more outcome>

For example, customers, testers and/or developers could write and discuss the following:

Scenario: Browse chart
Given visitor is logged in
And visitor is on home page
When visitor clicks on chart page link
Then page should display title “Top charts”
And page should display list of top songs

These scenarios can be used as both documentation and as acceptance criteria.
If you are new to BDD, there is a little twist. Each single step in the scenario is sufficiently small to be “automated”.

Indeed, there are already several frameworks (some more mature than others) that have story runners able to relate the intention (expressed by customers) to some code (written by developers), often using a simple naming conventions (e.g. a Given step can run an equivalent Given method). The list is growing fast: JBehave, RBehave, NBehave, RSPec, Cucumber, and so on.
At InnerWorkings, we experimented for a long time with various frameworks (including our own) but we now use a Ruby-based framework called Cucumber (a brilliant rewrite of the RSpec story runner, now deprecated).
Great stuff, you will say, but I don’t want to use Ruby. Your loss, I would reply :-). We love .NET too, but we use Ruby as well.

Although I’m sure many plain-text story runners based on .NET will emerge soon (if they are not there already), this weekend I started my own pet projet. Since it uses the new language ‘M’ (MGrammar, specifically) I decided to call it MisBehave.
I haven’t bothered building a story runner yet, but you may find this picture quite interesting:

intellipad.gif

It shows Intellipad, one of the tools provided with the Oslo CTP.

On the left column, I have an instance of the language. On the central column, I have the grammar I wrote, and the third column, shows the projected tree structure. So far, I have plain text converted into a structure that will be further processed by a program. Hopefully you can see where this is going.

I haven’t tested the grammar extensively. I will clean it up, add support for scenario reuse (GivenScenario), add FIT-style tables, improve the error notifications, and refine the projections.

A few people said that writing languages is difficult. Well, it is difficult indeed if you write general purpose languages.
For simple domain-specific languages though, the task is much simpler. I wish I could say it is really trivial, but I won’t ;-)

For educational purposes, you can download my grammar here (useful if you have the Oslo SDK).
Any feedback is more than welcome.
Now I’ll better stop toying around and start preparing for my presentation at Øredev!


Tags: , ,

Microsoft Oslo: Is it the end of XML?

Posted November 2nd, 2008 by Claudio Perrone

I’m just back from the Professional Developer Conference (PDC) in Los Angeles. I feel so jet-lagged that I don’t even know what time it is anymore. It’s dark and surely I should sleep, but my fingers keep typing on the keyboard as if they were taking on a life of their own.

Thanks to “Oslo“, the new platform for model-driven applications, I’m creating a simple textual Domain Specific Language (DSL). It’s a throwaway project, but I know my next one will be more ambitious.

I take another glance at the MGrammar language specification and I’m ready to code again. I expand my running example a bit to explore a potential scenario. Intellipad’s dynamic parser evaluates my language on the fly and duly reports some errors. No problem. I extend my grammar a tiny little more until I have no further warnings. I figured I can design my language interactively by example: it’s fun and totally test-driven!

I stare out my window for a moment, dreaming about a possible future. Writing DSL parsers is becoming such a trivial job that the need for many pesky visual DSL designers, noisy XML configuration files, and messy code-generation solutions may soon fade. With the exception of few notable scenarios (e.g. data transmission), I may very well enjoy the end of XML’s supremacy as a default file format.

I know, it’s just a dream. I’ll better go back to my task and write some more code.


Tags: ,

Notes from PDC: Windows Azure improves agility

Posted October 28th, 2008 by Claudio Perrone

It is a cold winter day in Dublin. A good friend of mine, an excellent software architect and entrepreneur, is finally ready to deploy his application. The last few months had been the toughest. He had spent almost 3 years building his dream. Being a perfectionist is not easy.

Dealing with those new damned servers was the hardest part. High scalability, reliability and availability do not come cheap, he thinks. Although they are essential concerns to his business however, they are not core.

Sometimes, during the process of building his application, I politely challenged his views. My Agile attitude screams for a “build cheap and fail fast” approach: build incrementally, release, see what works, and adapt.

Way too many startup companies waste tons of energy upfront setting up expensive hardware infrastructures. One day, their applications will handle all the extreme scalability problems that success will bring. Sadly, for most startups, that day will never come.

On the other side of the ocean, the Microsoft Professional Developer Conference (PDC) is taking place. I’m there, in a huge room with thousands of other developers. Ray Ozzie announces Windows Azure, the new “operating system” for cloud computing. People beside me take pictures, clap, and type on their keyboards frenetically. By now, many will have already twitted or blogged about Azure’s capabilities and features: automated service management, service hosting environment, load balancing, cloud storage, rich developer experience, and so forth.

Listening to the announcement, I begin to realize that it has never been so easy to attain load balancing, massive scalability and availability for any of my applications. Ever.

Expensive data centers will be completely replaced or augmented by “the cloud”, a set of pay-per-use configurable servers that companies won’t have to maintain directly. Microsoft is not the first company to provide a cloud computing solution but, for what I have seen so far, Windows Azure raises the bar to a whole new level.

In the next few months, Microsoft will evolve the product based on community feedback and, even more importantly, will disclose the pricing model and service level agreements. Windows Azure may allow us to affordably defer important decisions about how many servers we need to reliably support and scale our applications to the very latest responsible moment: when the popularity and needs of our applications will justify it. I have great hopes.


Tags:

Check my Øredev presentation teaser!

Posted September 28th, 2008 by Claudio Perrone

As I have started doing some serious work on refining the structure of my Agile tales of creative customer collaboration presentation, I thought it would be a good idea to create a 1-minute movie trailer to break the ice and remind you of the Øredev 2008 conference in Sweden in November.
So here it is! Put on your headphones and enjoy.


Øredev Presentation Teaser from Claudio Perrone on Vimeo.

So, what do you think? Do you like it? I certainly loved being the screenwriter, director, sound engineer and producer for exactly one minute of moving pictures! I now keep playing the soundtrack in my head though…mmm…I can’t get rid of it.

Let me share some trivia with you:

  • The soundtrack is based on the popular classical piece “Carmina Burana (O Fortuna)”.
  • I edited this work twice. I used iMovie ‘08 on my Mac at home initially, but I found its lack of features (e.g. a timeline) too frustrating. I then switched to my old Sony Vegas on Windows, finally overcoming my fears due to the complexity of its interface. Although I am a very casual user, I’ll probably consider trying Final Cut Pro in the future.
  • The first picture (yeah, that’s my big face, attached to that even bigger nose) is part of a great shot taken by the fabulous Martin Fowler at a recent software architecture workshop.
  • After I finished my first draft, my colleagues gave me a lot of very constructive feedback; my wife Irene, however, has been my biggest fan and most methodical reviewer. The other evening, she gave me a dense list of comments and then rushed me to go upstairs and fix the trailer, mainly so that she could watch one of her beloved TV shows in peace!

Anyway, the whole point of the teaser is to remind you that my talk is going to be on Friday morning, November 21st and it is going to be… oh, well, you’ll see. Mark it on your calendar and miss it at your peril ;-)

As you may have guessed already, I’m really looking forward to speaking at the conference and hopefully I’ll have the privilege to see you there.

The number and quality of speakers lined-up for the event is so impressive that, besides catching up with many good friends, I will avidly attend as many sessions as possible myself.


Tags:

Crafting memorable technical presentations

Posted August 11th, 2008 by Claudio Perrone

I have an embarrassing confession to make. I can easily shed a tear while watching a well-crafted movie. I really do. Someone in my family once teased me, saying that I’m so oversensitive that I would probably cry watching Daffy Duck.

There, I said it. Join my close friends and make fun of me. I’m a victim of the power of story to persuade and influence. My defenses are lowered, my disbelief is suspended and I’m vulnerable.

Not long ago, I was preparing for a technical presentation when I started wondering why movies can be so engaging and memorable while most presentations are comparatively dry and unremarkable.

Mainly thanks to Garr Reynolds and his magnificent Presentation Zen approach, I learned how to create slides with strong visual appeal: dense text and worn bullet points were replaced by a careful combination of words and images, creating a fertile ground for powerful metaphors and anecdotes.

keyWow. I suddenly realized I entered the world of visual storytelling.

I also recognized, however, that my early work was somewhat episodic, like a movie with great special effects but a weak story.

It was then that I became almost obsessed by one single thought: could I learn the craft of screenwriting and adapt it to elicit emotions in my own technical presentations?

I wanted to become a better visual storyteller, going beyond my self-limiting goal of giving “right” recommendations delivered in a clear fashion. I realized I had a chance to find my own voice and give meaning to facts with my experience, passion, and subjective interpretation.

To my greatest surprise, I uncovered a fascinating world that is affecting my journey through life to no end.

Next week, I’m going to share some of my findings at the legendary Software Architecture Workshop in Crested Butte (Colorado), where some of the most renowned thought leaders of our industry will gather.

This adventure has just begun.
The rest of it will unfold in time.


Tags:

Public speaking? Like a great movie!

Posted May 5th, 2008 by Claudio Perrone

I have really enjoyed doing some public speaking this year. I’m just back from the DDD Community Event in Galway and, once again, the feedback on my talk has been very positive. I always feel the responsibility of fulfilling people’s expectations, so hopefully I didn’t disappoint anybody. I must be doing something right though: 2 weeks ago I’ve been invited to present at Øredev, a ~1000 attendees conference in Sweden in November!

As promised, I put my slides on Slideshare. If you haven’t had a chance to attend, at least you could get a fair idea of what the session was all about. Let me know what you think! Don’t be fooled however, the slides are just a tiny part of the whole story.

In my exploration of how to design a better presentation, I used key books such as Presentation Zen and Beyond Bullet Points. I loved the ideas and approach of the first, the Hollywood-style methodology of the latter.
In my quest, I also came across Made to Stick, an eye-opener book which gives amazing examples of how simple, unexpected, concrete, credible and emotional stories can make ideas memorable.

So, what is this new presentation style about? While PowerPoint has been fundamentally the same for almost 20 years, our use of it is beginning to change. Slides are finally becoming more visual and essential, with a renewed appreciation of how people learn. I am particularly interested in the focus on stories and movie structures to make our messages more compelling.

It’s a fascinating idea isn’t it? In fact, I want to develop it further. Content matters more than ever. Pretty pictures that don’t carry a compelling story are just (annoying) pretty pictures.

In preparation for my next presentation, I just received 7 books on screen writing and more are on the way (speed-reading is handy, isn’t it?). No, I won’t be the next Stephen Spielberg and I don’t see myself walking down a red-carpet event any time soon. But I want to learn as much as I can from that industry to be better at mine. My challenge will be to present a potentially dense technical topic in a dramatic and captivating fashion. Who said it is going to be easy? It will be my pet project for my next few months, 48 minutes at a time.


Tags: , ,

The Developer Summit 2008 has been a triumph!

Posted April 13th, 2008 by Claudio Perrone

I’m just back from Stockholm, where I presented a session titled “Passionate Teams and Cooperative Customers: Agile tales of creative customer communication”.

Based on my direct experience, I offered some concrete suggestions of how to revert seemingly impossible (but common) situations in IT projects using a combination of agility, effective communication and deliberate creativity. All of these are skills that I’m firmly convinced we can learn and improve upon, and I was committed to do my best to push the boundaries and bring the message across.

successWhat can I say? The feedback has been absolutely tremendous, both on the core message and delivery style. I knew I had prepared something good, but boy, the response went far beyond my best expectations. I will follow Tom Raftery’s excellent advice and publish my slides on slideshare in a few weeks, right after my next presentation.

I will indeed repeat my session here in Ireland at the DDD Community Event in Galway on Saturday May 3rd. If you happen to be around, you may consider coming over and join the action; there are plenty of interesting sessions, the event is totally free and you can register here.

At the Swedish event, there were lots of speakers from ThoughtWorks, including my good friend Dan North who, a few hours before my turn, helped me refining a couple of messages I wanted to convey on Behaviour-Driven Development.

I’ve also been really privileged to meet ThoughtWorks’ founder and chairman, Roy Singham, at dinner. His fervour, values and clarity of intent are simply remarkable and totally explain why ThoughtWorks is such a unique and respected consultancy company all around the world. He confirmed that he is seriously considering opening an office in Sweden within this year, an opportunity that the best talents in Sweden should not miss!

There would be so much more to say about the event and the stories behind the new and old friends I met, but unfortunately I just exhausted my small quota of writing energy! Let me conclude by saying that the event has been a great success and was extremely well organized by Cornerstone. I’m really, really delighted that InnerWorkings has such a good partnership with Cornerstone in Sweden. Well done guys!


Tags: , ,

How do you get your ideas?

Posted March 14th, 2008 by Claudio Perrone

I get a lot of ideas on my way to the office, while on my motorbike. Perhaps Dublin’s traffic and pollution is good for my brain. Or maybe not. At one of our daily standup meetings this week, someone suggested that I should try wearing gloves and helmet at my desk :D


Tags:

Patterns of Systematic Creative Thinking: Extract Concept

Posted March 12th, 2008 by Claudio Perrone

As software developers, we love to delve deep into technical matters and write code that delivers value. It’s not a big secret, however, that many problems in software originate with people and not technology. In my experience, the biggest issues arise mostly due to corporate politics, lack of shared values, poor attitude, inadequate communication skills, and, lastly, faulty perceptions.

Ultimately, the way we see the world affects the way we logically reason about it.

Imagine a team of developers and a customer discussing what to do, using agile stories as their starting point. I use the term “customer” to describe the role of the domain expert who prioritizes stories and can clarify what problems a new system is supposed to resolve. Ideally, the customer knows precisely what to program and the team knows exactly how. More realistically, however, requirements evolve both as the team better appreciates the nuances of the business domain and the customer realizes the possibilities and constraints.

But what would happen if both the customer and the development team had a truly open mind and a willingness to be wrong? What solutions would they come up with if they all had a creative attitude and used a language designed to help them restructure their thoughts? I’m suggesting a catalog of practical refactorings and patterns that would add some rigor to anyone’s thinking process!

The great creativity masters can teach us very relevant lessons in this context. Edward De Bono’s “Serious Creativity” book, for example, contains lots of insights and sets the foundation of the first thinking pattern I’m going to introduce:

Extract Concept


You have identified a concrete idea that addresses a given objective.
Extract a broader concept to facilitate the creation of alternatives.

extract concept

Motivation

Extract Concept is one of the most regular techniques I use to deliberately increase my ability to generate alternatives. In fact, it is so basic that, at first glance, it might even seem too obvious. But don’t be fooled. Its mechanism taps into our human talents of abstract thinking, and it is a good step towards sharpening our creativity skills in a disciplined way.

Perhaps the most important benefit is that it forces me to look for alternatives even when I’m fairly confident that the first idea I have is good enough: I’d ask questions such as “this is a way of doing what?” and “how else can this be achieved?” This attitude is particularly important as I know that if I blindly trust my first instincts I may miss tremendous opportunities.

Alternatives must have a reference point: I’d ask “alternatives with reference to what?” A new concept becomes a fresh reference point that can somewhat change my perspective and lead to further ideas.

Mechanics

  1. Define the objective. It might be general or specific, but make sure that you are very clear about what you are focusing on!
  2. Identify one or more ideas relevant to such objective.
  3. For each of those ideas, extract a broader concept by asking: “this is a way of doing what?
  4. See how each concept can trigger further alternatives by asking: “how else can this be achieved?
  5. If applicable, find further alternatives by extracting an even broader concept (a direction) from one or more existing concepts.

Example

Extract Concept Example

  • I start defining the problem: “Provide useful help on our website”.
  • I quickly identify as many relevant ideas as I can. In this case is pretty easy to get a good few of those, but let’s pick 2 of them for simplicity sake:
    • Add “?” icon beside potentially confusing fields to open a popup dialog
    • Provide Email address
  • For each of those ideas, I extract one or more concepts:
    • Using the “?” icon, is a way of answering questions on the same page they arise
    • An email could be seen as a form of human interaction when visitors can’t find the help they need.
  • Using each concept, I can now identify more alternatives:
    • The concept “Answer questions on the same page they arise” leads me to the following ideas:
      • Use the “?” icon to inline-expand helpful hints
      • Add permanent “why?” sections beside each form section
      • Add (light-grey) instructive text directly inside each field (that disappears when the visitor clicks on a field)
      • Add help search section within page
      • Add inline validation (to show error messages within the form before the visitor has the opportunity to click the button that submits the form data
    • The concept “human interaction” helps me finding further alternatives:
      • Phone us (visitor calls us)
      • We phone you (visitor gives us his/her number, we call)
      • Forums (let visitors help themselves)
      • Chat

Tags: , ,

Something Worth Doing

Posted February 14th, 2008 by Claudio Perrone

Over the years I have used several productivity approaches, from goal-driven/top-down (e.g. Steven Covey’s First-Things-First quadrants) to more reactive/bottom-up (e.g. David Allen’s Getting Things Done).
I have also used more tactical approaches, such as the 48 minutes rule, which I always find surprisingly effective, particularly when I know I can work for some time uninterrupted.

To beat my worst procrastination habits however, I’m now using another set of productivity weapons: David Seah’s The Printable CEO tools.
In the last few months I started measuring where my time goes during my work day. It is always a good idea to know where you are, before taking corrective actions and get where you want to go, don’t you think? Armed with my trusted TimeLeft countdown, every fifteen minutes I tracked my activities (and distractions) in the Emergent Task Timer. After a while I got pretty used to it.

The form that really got my attention, however, is the Concrete Goals Tracker. David suggests a brilliant motivational approach which comes from his experience in the gaming industry: every time you complete something worth doing, you award yourself points.
In the last couple of years I’ve been doing quite a bit of research on motivational patterns emerged in game development and it is amazing to realize how simple things like adding a score to value our activities can trigger some of the most primitive mechanisms of our brain.

This morning, I thought I could use this system at home to help me focus on the tangible things I can do in preparation to my next talk.
Here is my first draft:

worth doing

Don’t worry if you don’t quite understand some of the items I have written for now. It will all become clearer in the next few weeks. Let’s just say that these are relevant to my talk. The actual deliverables (slides and narrative) are worth 10 points, the goal supporting activities are worth 5 or 2 points, the attitude 1 point.
So what do you think? Would a system like this work for you? In my case, I have absolutely no doubts!


Tags: