How elieahd/randomizer works
Main Components & Layers
• Library API: This is the public interface that client code will use. It is represented by the core randomizer methods (for instance, a simple “random(…)" API).
• Core Factory & Utilities: Include components like RandomizerFactory, RandomizerParameter, and RandomizerUtils. The factory likely orchestrates creation and registration/override of the different randomizer implementations.
• Randomizer Implementations:
• Field Randomizers: This branch includes subpackages for different kinds of fields. There are separate areas for “fields/dates” (with classes such as DateRandomizer, LocalDateRandomizer, etc.), “fields/numbers” (including IntegerRandomizer, DoubleRandomizer, etc.), and “fields/types” (like BooleanRandomizer, CharacterRandomizer, etc.).
• Collection Randomizers: Separate implementations for arrays, lists, sets, maps, and streams are present under the “randomizers/collections” package, each responsible for building a random collection.
• Inventories: The “inventories” package (for example, FieldRandomizerInventory) could be visualized as a registry or lookup component that tracks available randomizer implementations.
• Testing Suite: Although not part of the runtime system, include a “Tests” component to emphasize the importance of unit tests in verifying interactions and correctness.
• CI/CD & Build System Components (Optional): You may add a note on the side representing Maven (pom.xml), GitHub workflows, and sonar-project.properties. These items ensure code quality, automated testing, and deployment, and though not part of the runtime flow, they are essential for understanding the development lifecycle.
Relationships & Interactions
• A client calls the public API (possibly a static “random(…)" method) which delegates to the RandomizerFactory.
• The Factory centrally manages which specific randomizer implementation to use based on the type (and may check or use the inventory for available implementations).
• Once a specific randomizer is chosen, it utilizes utility methods from RandomizerUtils (if any) to perform randomization.
• For collections, the factory would delegate to collection-specific classes (ArrayRandomizer, ListRandomizer, etc.) which then internally might call upon the field randomizers when creating elements.
• Test components to show that each of these layers is validated by dedicated test classes in the “src/test” packages.
Architectural Patterns & Principles
• The Factory Pattern is employed, as seen in RandomizerFactory, which abstracts the creation of various randomizer implementations.
• There is a clear separation of concerns by dividing randomization logic into field-specific and collection-specific packages.