Tuesday, February 19, 2008

Behavior Driven Development

Today we were introduced to Behavior Driven Development (BDD). So what is BDD. Think of the Tetris game. A piece is falling in the well with some garbage at the bottom. Depending upon the orientation of the piece falling from top, a line can disappear or garbage can increase. Similar is the case of the Schroedinger Cat where depending upon the observation the state of cat is dead or alive.

Owing to this fact, the same event can have different outcome depending upon the context. It gives importance to the fact that why we are writing code rather than the technical details and therefore makes the code simple to understand and translate between development team and business.

An example can be: Given that you are a Java Developer when you are on a project then you should code in Java.

So we were shown how to do BDD. A single test method may have name something like this shouldreturnthis(), this gives a very good idea of what we are supposed to test.

This is the basic that I learned today, thanks to Elizabeth Keogh.

One more thing, I learnt was that we can use Single Responsibility Principle (SRP) to get away with getter and setter methods. It helps in better cohesion when we return the required thing from a class rather than accessing and changing the private instance variables of a class. Tommorow is the session on SRP and will get more information on that. Very excited for tomorrow’s session……


Post a Comment

Subscribe to Post Comments [Atom]

<< Home