Earlier this year I was asked to evaluate a book concept about Spock framework. Taking into account that I am a big fan of this library I was extremely happy to see that measures were taken to create a book focused on this particular topic. Hopefully the book will boost even further the popularity of Spock. As always high interest of a product is the best motivation for its authors to continue its development. Few months later, I am given a possibility to read the early edition of this book and as well was asked for a review.
What is Spock?
Spock is a unit testing framework that in great extent utilizes Groovy’s syntax making your tests comprehensible and easy on the eyes. Although it is a Groovy technology you can use it to test your Java classes as well. What is the most important is that Spock makes writing tests fun. And I really mean it.
I have to admit that even knowing all the benefits of TDD and tests over all I considered writing them as little pain in the neck. How has that changed when I started using Spock?
Quite recently Cybercom company announced a Master Coder challange. The competition will be divided into 10 stages, each of them involving a programming task. Despite missing two first assignments I have taken up the gauntlet and completed task #3.
The goal in this stage was to create a number system converter. Converter should be able to handle systems in the range of 2 to 36. For the working application (successfully converting numbers between systems) you would get 200 points. It was possible to get additional 20 points for introducing an exceptional solution. However, it was prohibited to use conditional statements, and conditional expressions. Thus, for every if, else or switch in your code you would be given respectively -5, -10 or -20 points. Numbers should be represented by following characters:
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z
Continue reading Master Coder Challenge #3 : Number systems converter