How rossbu/commontools works
Main Components
• Build & Configuration: Begin with the build system (Gradle) and version control (Git). These form the base layer which manages dependencies (Java 11, Java 13 with preview features), build processes, and Continuous Integration (CI) via the GitHub workflows.
• Core Demonstration Modules: The source code under “src/main” is organized into multiple packages:
– com/config: Contains configuration classes for async operations, JSON (Jackson), REST configurations, and HTTP clients. This is your “infrastructure” layer.
– com/benchmark: Some benchmark examples (for instance, StringBenchmark) and the dedicated JMH benchmarks under “src/jmh”, meant for performance testing and comparisons.
– com/jdk: A suite of demos illustrating various Java Development Kit features across different versions (jdk8, jdk9, jdk10, etc.), which also helps in understanding evolving language features.
– com/pojo and com/service: Represent data models (plain objects like CarInfo, Dealer, etc.) and a sample service (like EmailService), showing some application structure.
• Test Modules: Located under “src/test”, these provide unit and integration tests related to several demos.
• Documentation and Supporting Materials: The “doc” folder includes various markdown files with tips on Java, multithreading, and more. These provide context and additional guidance on how to work with different aspects of the project.
Relationships and Interactions
• The Gradle build and Git workflows (shown in .github and gradle directories) coordinate the build, testing, and deployment processes.
• The configuration classes (in com/config) are consumed by various demo modules (com/demo) to enable features like async handling, REST client setup, or JSON formatting.
• The “demo” category is further broken down into specialized components such as asynchronous programming, data security (with encryption, hashing, etc.), multithreading (with various examples on thread lifecycle, interrupts, thread pools), and HTTP/server demos.
• The “jdk” demos serve as standalone examples elaborating on Java language specifics with dependencies on core Java classes.
Architectural Patterns and Design Principles
• Modularization: The project is divided into clearly defined functional areas (configs, demos, benchmarks, tests) representing a modular approach.
• Separation of Concerns: There is a logical separation between configuration and demonstration/business logic, and even within demos (e.g., async vs data security vs JDK feature demos).
Additional Details
• If feasible, use a hierarchical layout where the build/CI system is shown at the bottom/foundation, configuration at the next layer, followed by the different demo modules, and finally, tests verifying functionality at the top.