Roman Numerals Java kata

Siguiendo con la serie de katas, ahora toca la kata de los números romanos. Es simple, se trata de convertir de entero a romano y viceversa.

Para darle una vuelta de tuerca me he propuesto seguir los principios KISS y SOLID, que se recomienda tener en mente cuando refactoricemos. Y ya de paso me he propuesto implementar una Interfaz fluida basada en métodos estáticos:

  • convert(roman).toArabic();
  • convert(arabic).toRoman();

El video de la kata lo teneis en Youtube:

El código de la kata aquí: romannumerals-fluentinterface-solid.zip

Y por último un diagrama de clases que ilustra como el diseño respeta el diseño Open/Close, en tanto en cuanto fácilmente, añadiendo más subclases, podremos ampliar a tantos sistemas numéricos como queramos (Octal, Hexadecimal,…):

Class Diagram

One thought on “Roman Numerals Java kata

  1. Hi, I am very sorry for the trouble you have. I am arafid that I may not offter you an English menu. Basically, first solider all the leds, the 64 leds in each layer share the same anode, while the 8 leds in each column shared the same cathode. So there are 8 anodes and 64 cathodes on the board.About programming, if you are using the Xuping’s version, plug the USB cable, and you would find a serial port on your PC. Then you may send 2 bytes, like 0xf1 0 00 , which refers to turn off all leds, 0xf1 0xff means turns all leds on. There are other 2 commands, 0xf1, 0xf2.There is a blog about 3D8 driven by arduino. There is a sample code there. Wish it would make more sense to you.

Leave a Reply

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