Coder Social home page Coder Social logo

diamondkata's Introduction

Diamond Kata

This project contains sourcefiles and a skeleton for a solution to the Diamond Kata. You can of course just code this kata from scratch in any way you wish. This repo will help you to explore two different approaches to the problem - an interative approach, where you 'recycle' test cases, and an incremental approach, where all test cases are valid for the full solution.

For more discussion of 'test recycling' see Seb Rose's blog post

So far I have starting code for the problem in Scala, Java and Python. The original version was the Scala, so please be forgiving if I have used Scala idioms or generally translated it badly into the other languages. I welcome pull requests with improvements and/or translations to more programming languages.

Kata Description

(this description is copied from http://cyber-dojo.org)

Given a letter print a diamond starting with 'A' with the supplied letter at the widest point.

For example: print-diamond 'E' prints

    A
   B B
  C   C
 D     D
E       E
 D     D
  C   C
   B B
    A

For example: print-diamond 'C' prints

  A
 B B
C   C
 B B
  A

How to use the code in this repo

  • For an 'incremental' approach, test drive your implementation using 'DiamondIncrementalTest' or 'DiamondIncrementalSpec'.
  • For an 'iterative' approach, test drive your implementation using 'DiamondIterativeTest' or 'DiamondIterativeSpec'.

I suggest you try the kata both ways. In a Coding Dojo, you could have half the group do it one way while the other half does it the other way, then swap. Suggested questions for the retrospective when you compare the approaches:

  • Do the tests lead you to solve the problem in small steps?
  • How easy is it to pinpoint what is wrong when you make a mistake?
  • How easy is it to refactor the implementation?
  • The incremental tests define several public methods on Diamond. Should they be public? What would happen if they weren't?
  • The iterative approach asks you to delete test cases along the way. Should you do that in general?
  • Which approach (iterative or incremental) should you use when doing TDD in general?

diamondkata's People

Contributors

chaabani-anis avatar emilybache avatar hulincedric avatar nicoudsarah avatar vlambret avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  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.