A modern, production-ready dice rolling simulator developed in Java. This project has been heavily refined from a basic OOP script into a full-featured Desktop Application utilizing an embedded SQLite database for roll history, adhering precisely to modern Java MVC and Clean Architecture conventions.
- Embedded History Database: All rolls are persisted locally to
dice_history.dbusing SQLite via JDBC. - Robust Domain Logic: Encapsulated
DieandDiceBagclasses representing accurate stochastic probability without cross-contamination. - Industry Standard Architecture:
- MVC Pattern: Separation of concerns between
ui(Views),service(Business Logic), andrepository(Data Access). - Maven Build System: Standardized dependency management and build pipeline.
- MVC Pattern: Separation of concerns between
- Testing: Comprehensive JUnit 5 test suite validating the domain logic and edge cases.
- Logging: SLF4J integrated for production-ready audit trails vs standard
System.out.println.
- Language: Java 17+
- Build Tool: Maven 3.x
- Database: SQLite (Embedded, zero-config)
- UI Framework: Java Swing (System Look-and-Feel)
- Testing: JUnit 5 (Jupiter)
- Logging: SLF4J
dice-roller/
βββ pom.xml
βββ src/
βββ main/java/com/diceroller/
β βββ domain/ -> Core logic (Die, DiceBag, RollHistory)
β βββ repository/ -> Database models and SQLite JDBC integration
β βββ service/ -> Dice roll orchestration and persistence logic
β βββ ui/ -> MainApp Swing GUI
βββ test/java/com/diceroller/
βββ domain/ -> Unit tests
- Open a terminal in the project root directory.
- Compile and run the tests:
mvn clean test - Run the application! To execute via Maven compiler plugin natively:
mvn clean compile exec:java -Dexec.mainClass="com.diceroller.ui.MainApp"
- Open/Import the project folder as a Maven project.
- Wait for dependencies to index.
- Run
MainApp.javalocated insrc/main/java/com/diceroller/ui/.