For a long time, I have underrated coding katas. I used to say there is no reason to do the same task day by day just to improve my coding skills. Now, I learn a new technology stack, the Java stack and it has a lot of challenges for me.

After some learning stuff and fails, I have figured out that I spend too much time not by coding but by figuring out the code related infrastructure. Managing maven dependencies are a pain in the ass for me and almost every component has a new challenge because of the huge difference between .Net stack that I get used to and the Java stack that is a brand new to me.

So, after some fails, I have decided to do some coding katas just to learn the basic infrastructure and speed up myself.

FizzBuzz

FizzBuzz is a coding kata that teaches the basics of Test Driven Development. The task is simple. You count from 1 to 100 and for every number, there is the rule:

  • If it can be divided by 3, the output is ‘Fizz’
  • If it can be divided by 5, the output is ‘Buzz’
  • If it can be divided both by 3 and 5, the output is ‘FizzBuzz’
  • In other cases, we give back the input as an output

First day – OMG

The first day was terrible. First of all, I have created an empty Maven project. After that, I had to figure out what is the recommended project structure (that was the moment when I have realized that an empty Maven project does not contain the default project and package structure, I have to create this).

After these, I found the JUnit dependency and I thought that will be great. After some tests, I have figured out that the default JUnit version is 4 that I found and it does not support parameterized tests. After some googling, I met with some kind of plugin (or extension) that allowed me to write parameterized tests but in a very uncomfortable way (I wanted the same experience as I had using NUnit before).

And the problems came one by one. It takes about 5 minutes to implement a solution to the FizzBuzz problem. If I want to do that with a test-driven approach, it took about 20 minutes to me using .Net stack that I am familiar with.

On the first day, solving the FizzBuzz coding kata using Test Driven Development approach, took 58 minutes to me.

First reaction

I wanted to cry. I thought there is no way that such a simple exercise takes an hour for a Senior Software Engineer.

Analyze and improve

After a short walk, my mind calmed down and I could think about that hour. I tried to remember to the biggest gaps in my knowledge and wrote down a list of what I have to read during the night. That was on my list after the first day:

  • Maven project structure. Can I generate the default folder structure?
  • Unit testing. Is there any useful alternative to JUnit 4?
  • IntelliJ: code refactoring shortcuts
  • IntelliJ: run all tests shortcut

Doing the coding kata for a week

There was a long week when I felt pain every single day. I made a wrong Maven dependency structure, I have misconfigured the configuration file and could not run tests, I have tried 3 different unit testing tool and one time I made an unrealistic package structure.

But it took less amount of time to finish the Kata every single day.

Conclusion

After one week, I could finish the Kata under 20 minutes, including exception handling and boundary check.

Now, I can create a new project with necessary dependencies relative quickly and the most important part is that I have gained some confidence in using these tools.

 


InvisibleProgrammer

A remote senior software engineer.

5 Comments

Boris Mochel · July 22, 2018 at 8:57 am

What’s up, after reading this awesome piece

Diego Billey · July 23, 2018 at 6:18 am

sound like you know what you?re talking about! Thanks

Graciela Mari · July 24, 2018 at 4:40 am

I like the helpful info you provide in your articles. I will bookmark your weblog and check again here regularly.

Reginald Kao · August 1, 2018 at 11:23 am

Hello. impressive job. I did not anticipate this.

no credit check loans raleigh nc · February 8, 2019 at 7:24 am

You argue like me! Love it!

Leave a Reply

Your email address will not be published. Required fields are marked *