Sunday 26 October 2014

Kata 1 - FizzBuzz in Java ( step by step)


It has been a long time since the last time I wrote here. This time I'm going to write about a completely different thing.

One week ago I started reading about Katas and TDD. Since then I have been doing two Katas every day. With this I am improving my Java skills and learning how to use TDD.

TDD (Test-driven development) is a software development process  that relies on the repetition of a very short development cycle: first the developer writes an (initially failing) automated test case that defines a desired improvement or new function, then produces the minimum amount of code to pass that test, and finally refactors the new code to acceptable standards.

KATA  is an exercise in programming which helps a programmer hone their skills through practice and repetition.

In this article I will do FizzBuzz Kata step by step. This is one of the easiest Katas.

FizzBuzz Kata has 4 easy rules :


  1. If the number is divisible by 3 should return "Fizz" .
  2. If the number is divisible by 5 should return "Buzz" .
  3. If the number is divisible by 15 should return "FizzBuzz" .
  4. If the number is not divisible by 3, 5 or 15 should return that number as String.

First of all you need an IDE with some unitary testing plugin. I am going to use eclipse with Junit because is the one that comes with it. You can do  Katas with the IDE you want, the unitary testing plugin you want and the programming language you prefer.

When you have your IDE ready, you have to create two classes, one FizzBuzzTest.java and FizzBuzz.java and put them in the same package.

Video step by step :



In the next video I will try to explain what I am doing, this is a first try.

For any question leave a comment.



1 comment:

  1. Our client can choose any of them as per their convenient.Cheap Price Call Girls in Delhi We are also open to send our angels any other place of your choice. Escorts Rate in Aerocity are waiting eagerly to meet you.Cheap Price Call Girls in Agra You need to decide whether you want to meet them at home or at any hotel.Cheap Price Call Girls in Ahmedabad If you are facing any challenges in arranging any place,Cheap Price Call Girls in Agra let me inform you that we have tie-ups with 3 start hotels as well as 5 start hotels.Cheap Price Call Girls in Haridwar Check our other services...

    ReplyDelete