- Introduction
- DevOps
- Refactor
- Conclusion
This README provides an overview of the Kata - Datanumia project, showcasing its quality, code coverage, and maintainability metrics. It also outlines DevOps practices, including the use of Devcontainer for a consistent development environment and GitHub Actions integrated with SonarCloud for continuous code quality monitoring.
I have implemented a Devcontainer setup to facilitate development on this project. Devcontainer allows developers to use Visual Studio Code in a containerized environment, ensuring a consistent development environment for all team members. It automates the installation of essential tools such as Java, Maven, and Sonar Scanner.
To use Devcontainer, please install the Remote - Containers extension in Visual Studio Code.
I have integrated GitHub Actions with SonarCloud to run code analysis on each push to the master branch. This integration checks the code quality and code coverage of the project, providing valuable insights into code maintainability and reliability.
To view the analysis results, click on the badge at the top of this README or here.
In some instances, test names do not adhere to appropriate naming conventions or lack consistency with other tests.
Tests may exhibit redundancy or perform unnecessary work, making them less efficient.
I have introduced parameterized tests to reduce code repetition and improve test readability.
To ensure uniformity in test method naming, I have aligned them with Java naming conventions and consistent naming practices across the project.
The main class, Yatzy, contains an excessive number of methods, some of which are overly lengthy or do not adhere to proper naming conventions. This violates the Single Responsibility Principle.
Certain methods suffer from an overload of parameters, leading to readability and maintainability issues. Additionally, some parameter names do not follow naming conventions.
Methods lack consistent scoping, with some being static while others are not.
I have refactored the Yatzy class into multiple smaller classes, each with a specific role. To split the class, I used the design pattern command. I created a class for each kind of score calculator, and I created a class YatzyMod to manage the score calculator. The class Yatzy is now a facade and the Single responsibility principle is respected.
I added a method to validate dice values, ensuring that incorrect values result in an exception.
To enhance code readability, I reduced the number of parameters in certain methods by introducing a new class, "Dices," to manage dice-related operations.
I have reduced the size of methods to improve code comprehension and maintainability. To do that I used IntStream and Stream API.
Thank you for exploring the Kata - Datanumia project. I have focused on enhancing code quality, maintainability, and test readability, as well as implementing DevOps practices for a smoother development experience, including the use of Devcontainer and GitHub Actions integrated with SonarCloud. Your feedback and contributions are greatly appreciated.