Tag Archives: UML

Roman Numerals Java kata

Continuing with kata series, here we have roman numeral kata. Simple, you have to convert roman to integer and integer to rman.

In order to improve other things I purpossed to follow KISS and SOLID principles. Also creating a Fluent Interface based on static methods:

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

The movie on Youtube:

Kata code here: romannumerals-fluentinterface-solid.zip

Finally, a class diagram illustrating the Open/Close principle which I tried to follow, here we can add more numeric systems only by adding the corresponding Number subclasses (Octal, Hexadecimal,…):

Class Diagram

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

Generating code from UML with Eclipse

Eclipse has a project called EMF (Eclipse Modelling Framework) cool for drawing UML2 Diagrams. But my goal in this post is to draw UML2 class diagrams and create the java skeleton for the classes.

In the application architecture is recommended separate the domain model from services, business logic etc. EMF gives you the tool to create class diagrams and to generate the code with them.

Continue reading Generating code from UML with Eclipse