top of page

Media Rental System
Modular Backend Architecture with File-Based Persistence and Exception Handling

Executive Technical Summary

A backend-oriented Java application for managing a catalog of polymorphic media items—including eBooks, Movie DVDs, and Music CDs—with support for loading, searching, renting, and returning inventory. The system emphasizes predictable state management, file-based persistence, and disciplined exception handling to ensure correctness and recoverability across all operations. The design focuses on object-oriented modeling, separation of concerns, and traceable system behavior through structured console workflows

System Architecture Overview

The system is organized around a clean separation between user interaction, orchestration logic, domain models, and persistence mechanisms.

Architecture layers:

  • Console UI Layer: Command-driven menus and user prompts

  • Controller Layer: Coordinates user actions and delegates to backend services

  • Manager Layer: Centralized orchestration for loading media, performing searches, and handling rentals

  • Domain Layer: Polymorphic media models with encapsulated attributes and behavior

  • Persistence Layer: Directory-based file storage and update logic

  • Exception Handling Layer: Validation and error reporting for invalid operations

This structure isolates business logic from I/O concerns and supports predictable system evolution.

Repository Structure

The repository follows a modular backend structure that separates media domain modeling, rental workflows, persistence, exception handling, and user interaction. This layout emphasizes object-oriented design, polymorphism, and safe file-based I/O operations within a maintainable application architecture.

 

media-rental-system/

├── src/

│   ├── main/

│   │   └── java/

│   │       ├── media/              # Media domain hierarchy

│   │       ├── rental/             # Rental operations

│   │       ├── manager/            # Application coordination

│   │       ├── exception/          # Exception handling

│   │       ├── persistence/        # File-based media storage

│   │       └── ui/                 # Menu-driven CLI

│   └── test/

│       └── java/                   # Test scaffolding

├── data/                           # Media inventory files

├── README.md

└── pom.xml

Core Design Decisions & Rationale

Polymorphic Media Hierarchy

A common Media superclass is extended by EBookMovieDVD, and MusicCD.

Rationale:

  • Enables unified handling of media items

  • Supports subclass-specific attributes and formatting

  • Demonstrates inheritance and dynamic binding

   

Manager-Centric Orchestration

All file operations, searches, and rental logic are centralized in a Manager component.

Rationale:

  • Prevents UI code from managing persistence

  • Enforces consistent system behavior

  • Simplifies validation and error handling

  

Directory-Based File Persistence

Media records are stored as structured text files within type-specific directories.

Rationale:

  • Human-readable and easy to inspect

  • Avoids database complexity

  • Supports deterministic reload and update cycles

  

Validation and Exception Handling Strategy

The system employs defensive validation and structured exception handling.

Handled cases include:

  • Invalid directory paths

  • Malformed media files

  • Invalid media IDs

  • Rental attempts on unavailable items

Exceptions are surfaced with clear diagnostic messages, allowing safe recovery.

Domain Model & State Logic

Media Type Inheritance

Each media subclass encapsulates:

  • Type-specific attributes (e.g., chapters, director, artist)

  • Customized string representations for display and persistence

  

Availability and Rental State Management

Each media item maintains a clear availability state:

  • Available

  • Rented

State transitions are enforced centrally to prevent inconsistent inventory status.

Validation & Error Handling Strategy

Validation occurs at all system boundaries:

  • Input parsing and menu selection

  • Media ID lookup

  • File loading and directory access

  • Rental and return operations

All invalid operations fail fast with explicit error messaging.

Testing & Verification Approach

System correctness was verified through structured execution scenarios documented in the accompanying project PDF, including:

  • Successful media loading

  • Title-based searches

  • Valid and invalid rental attempts

  • Return workflows

  • Persistence verification across program restarts

These scenarios demonstrate deterministic behavior and robust error handling.

Tools & Technologies

  • Language: Java

  • Paradigm: Object-Oriented Programming

  • Persistence: Directory-based text files

  • I/O: java.io

  • Error Handling: Try/catch with domain-specific messaging

  • UI: Console-based command-driven interface

  • Documentation: PDF-based test scenario validation

Outcome & Engineering Takeaways

Engineering Capabilities Demonstrated

  • Object-oriented modeling using inheritance and polymorphism

  • Centralized orchestration through manager components

  • File-based persistence and reload safety

  • Defensive programming with validation and exception handling

  • Separation of concerns across UI, logic, and data layers

  • Clear communication of system behavior through documentation

 

System Qualities Achieved

  • Correctness: enforced validation and controlled state changes

  • Maintainability: modular structure and centralized logic

  • Recoverability: safe handling of invalid input and I/O failures

  • Traceability: predictable console flows and structured output

bottom of page