A robust command-driven coding game platform implementing modern object-oriented design patterns and best practices.
- Overview
- Key Features
- Architecture
- Setup Instructions
- Usage
- Folder Structure
- Sample Code
- Commands
- Contributing
- License
ME_OBJECT_MODELING_V2_MODULE_CONTROLLER is a Java-based application that demonstrates advanced object modeling concepts through a coding game platform. The project showcases clean architecture principles, command pattern implementation, and separation of concerns.
- User Management: Register and manage users with different skill levels
- Contest Management: Create and manage coding contests with varying difficulty levels
- Question Management: Handle coding questions with different difficulty ratings
- Leaderboard System: Track and display user performance
- Command-Driven Interface: Execute operations through a flexible command pattern
- ๐๏ธ Clean Architecture: Follows separation of concerns with distinct layers (entities, repositories, services, commands)
- ๐ฏ Command Pattern: Extensible command-based operation system
- ๐พ In-Memory Repository: Fast data access with repository pattern implementation
- ๐ง Dependency Injection: Loose coupling through constructor-based DI
- ๐ Data Transfer Objects: Clean data flow between layers
- ๐งช Test Coverage: Comprehensive unit tests for all components
- ๐ Type Safety: Strong typing with Java generics
The application follows a layered architecture:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Application Layer โ
โ (App.java) โ
โโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโ
โ Command Layer โ
โ (Command Pattern Implementation) โ
โโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโ
โ Service Layer โ
โ (Business Logic) โ
โโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโ
โ Repository Layer โ
โ (Data Access) โ
โโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโ
โ Entity Layer โ
โ (Domain Models) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
- Java Development Kit (JDK): Version 11 or higher
- Gradle: Version 7.x or higher (or use the included wrapper)
- Git: For cloning the repository
-
Clone the repository
git clone <repository-url> cd anantsaini-india-ME_OBJECT_MODELING_V2
-
Build the project
./gradlew build
-
Run tests
./gradlew test -
Run the application
./gradlew run
Or alternatively:
java -jar build/libs/ME_OBJECT_MODELING_V2.jar
The application reads commands from input.txt file:
./gradlew run < input.txtThe application accepts commands in the following format:
CREATE_USER <name> <score>
CREATE_QUESTION <title> <level> <score>
CREATE_CONTEST <name> <level> <creator> <questionIds>
LIST_CONTEST <level>
ATTEND_CONTEST <contestId> <userName>
RUN_CONTEST <contestId> <userName>
LEADERBOARD <order>
CREATE_USER Ross 1500
CREATE_USER Monica 1800
CREATE_QUESTION Binary_Search LOW 100
CREATE_CONTEST June_Challenge LOW Ross Q1,Q2
LIST_CONTEST LOWanantsaini-india-ME_OBJECT_MODELING_V2/
โ
โโโ src/
โ โโโ main/
โ โ โโโ java/
โ โ โโโ com/
โ โ โโโ crio/
โ โ โโโ codingame/
โ โ โโโ App.java # Application entry point
โ โ โโโ appConfig/ # Application configuration
โ โ โโโ commands/ # Command implementations
โ โ โ โโโ CreateUserCommand.java
โ โ โ โโโ CreateQuestionCommand.java
โ โ โ โโโ CreateContestCommand.java
โ โ โ โโโ ...
โ โ โโโ dtos/ # Data Transfer Objects
โ โ โโโ entities/ # Domain models
โ โ โ โโโ User.java
โ โ โ โโโ Question.java
โ โ โ โโโ Contest.java
โ โ โ โโโ ...
โ โ โโโ exceptions/ # Custom exceptions
โ โ โโโ repositories/ # Data access layer
โ โ โ โโโ IUserRepository.java
โ โ โ โโโ UserRepository.java
โ โ โ โโโ ...
โ โ โโโ services/ # Business logic
โ โ โโโ UserService.java
โ โ โโโ ContestService.java
โ โ โโโ ...
โ โ
โ โโโ test/
โ โโโ java/
โ โโโ com/
โ โโโ crio/
โ โโโ codingame/ # Unit tests
โ
โโโ build.gradle # Build configuration
โโโ gradlew # Gradle wrapper (Unix)
โโโ gradlew.bat # Gradle wrapper (Windows)
โโโ input.txt # Sample input file
โโโ songs.csv # Sample data file
โโโ README.md # This file
// Using the UserService
UserService userService = new UserService(userRepository);
User user = userService.create("John Doe", 1500);
System.out.println("Created user: " + user.getName());// Using the ContestService
ContestService contestService = new ContestService(
contestRepository,
questionRepository,
userRepository
);
Contest contest = contestService.create(
"Summer Challenge",
Level.MEDIUM,
"creator123",
Arrays.asList("Q1", "Q2", "Q3")
);// Command pattern implementation
CommandInvoker invoker = new CommandInvoker();
CreateUserCommand command = new CreateUserCommand(userService);
invoker.executeCommand("CREATE_USER Alice 2000", command);| Command | Description | Example |
|---|---|---|
CREATE_USER |
Create a new user | CREATE_USER Ross 1500 |
CREATE_QUESTION |
Create a new question | CREATE_QUESTION BinarySearch LOW 100 |
CREATE_CONTEST |
Create a new contest | CREATE_CONTEST JuneContest LOW Ross Q1,Q2 |
LIST_CONTEST |
List contests by level | LIST_CONTEST LOW |
ATTEND_CONTEST |
Register for a contest | ATTEND_CONTEST C1 Ross |
RUN_CONTEST |
Participate in contest | RUN_CONTEST C1 Ross |
LEADERBOARD |
Display leaderboard | LEADERBOARD ASC |
WITHDRAW_CONTEST |
Withdraw from contest | WITHDRAW_CONTEST C1 Ross |
We welcome contributions to improve the project! Here's how you can help:
-
Fork the repository
git fork <repository-url>
-
Create a feature branch
git checkout -b feature/amazing-feature
-
Make your changes
- Write clean, documented code
- Follow existing code style and patterns
- Add tests for new functionality
-
Commit your changes
git commit -m 'Add some amazing feature' -
Push to the branch
git push origin feature/amazing-feature
-
Open a Pull Request
- Follow Java naming conventions
- Use meaningful variable and method names
- Write JavaDoc comments for public methods
- Keep methods focused and concise
- Maintain test coverage above 80%
Ensure all tests pass before submitting:
./gradlew test
./gradlew buildThis project is part of the Crio.Do learning platform.
- Issues: Please report bugs and issues through the GitLab issue tracker
- Questions: Reach out through the Crio.Do platform
- Built as part of the Crio.Do ME_OBJECT_MODELING_V2 module
- Special thanks to all contributors and maintainers
Made with โค๏ธ by Crio.Do Learners
Last Updated: October 2025