Git Product home page Git Product logo

diamond_kata's Introduction

Diamond Kata

After reading a blog post by Ron Jeffries, where he mentions other posts by Alistair Cockburn and Seb Rose, I decided to have a go at the exercise.

My approach to TDD is different from the one used by Ron Jeffries and the final solution was also different. In my case, I decided not to make any design decisions at all, with the exception of the public method on the Diamond class, responsible for creating an array with all the diamond's rows.

I wrote a sequence of very small tests and just wrote enough code in order to make them pass. Test after test, I used the refactoring phase to clean up the code. If you follow the tests (they are in the order I created them), you will see that I created tests which I knew would force code duplication. I do that on purpose. I write very similar tests that force me to write new code that is very similar to code that already exist. This helps me to identify duplication without speculation. Once the duplication is identified, I use the refactoring phase to make the code more generic, removing the duplication.

What was interesting to see was that both Ron Jeffries and I had no pre-conceived design and we were both able to get to a solution without designing up-front.

Admitedly, my solution needs some polishing but I was able to prove the point I wanted to prove: I could grow the solution to the problem through tests and without any design up-front. The code now does what needs to be done and from now on it is just a matter of refactoring and making it better. But I'll leave it to another time.

In order to see all the exact steps, have a look at the commit history.

diamond_kata's People

Contributors

sandromancuso avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.