How ziblic/hwr-oop-project-gruppe-3 works
Project Type and Purpose
• This is a small, CLI-based full-stack (single-module) application written in Kotlin.
• Purpose: a Pokémon-style battle simulator with a command-line interface. It uses OOP design and TDD.
File Structure
• Top-level build files and tools: pom.xml, mvnw, justfile, ktlint, Maven wrapper under .mvn/.
• Executable CLI: the tnp script in project root.
• Source code in src/main/kotlin/hwr/oop/tnp/: domain model and engine classes.
• Tests in src/test/kotlin/hwr/oop/tnp/: one-to-one coverage of domain/engine.
Key Components
a. Presentation Layer (CLI)
• tnp script (invokes the fat-jar or main entry).
• Responsible for reading user commands and printing output.
b. Application Layer
• Game orchestration class: Game.kt
• Parses user commands: GameParser.kt
• Loads game data/resources: GameLoader.kt
c. Domain Layer
• Core entities: Monster.kt, Trainer.kt, Type.kt, Attack.kt, BattleStats.kt
• Constants and configuration: Constants.kt
d. Infrastructure Layer
• Build tools: Maven wrapper, Just
• Ktlint formatting workflow
• GitHub Actions for linting and testing
e. Testing Suite
• JUnit tests mirroring each domain & engine class
Interactions and Data Flow
• CLI invokes main() → Game
• Game uses GameParser to interpret commands
• Parsed commands trigger GameLoader (e.g., load monster data)
• Game constructs or fetches domain objects (Monster, Trainer, etc.)
• Battle logic: BattleStats and Attack compute fight outcomes
• Results return back up to Game → CLI prints results
Architectural Patterns & Principles
• Layered architecture (Presentation → Application → Domain → Infrastructure)
• Single executable JAR/CLI (no microservices)
• OOP principles: encapsulation (each entity class), single-responsibility (separate parser/loader)
• Test-Driven Development: each domain class has a corresponding test
Essential Elements
• Optional: note the main entry point (main() in Game.kt)