Skip to content

PramithaMJ/java-masterclass

Repository files navigation

Java Engineering Masterclass πŸš€

An interactive, production-grade React application for mastering advanced Java/JVM concepts through visual simulations and deep-dive theory.

React TypeScript Vite License

🎯 Features

Interactive Simulators

Module Description Visualization
Garbage Collection Eden, Survivor, Old Gen memory pools Object allocation & GC cycles
Concurrency Monitor locks, Entry/Wait sets Thread state transitions
JIT Compilation Tiered compilation (Interpreted β†’ C1 β†’ C2) Profiling & optimization
Java Memory Model CPU caches, Main Memory, Volatile Cache coherence & visibility
Static vs Instance Metaspace vs Heap memory layout Static field sharing

Educational Theory

Each module includes comprehensive "Engineer's Guide" content covering:

  • Under-the-hood JVM internals
  • Best practices and anti-patterns
  • Thread safety considerations
  • Performance implications

πŸ—οΈ Architecture

Built following SOLID principles with a modular, scalable architecture:

src/
β”œβ”€β”€ components/           # Reusable UI components
β”‚   β”œβ”€β”€ Layout/          # Header, Layout wrapper
β”‚   β”œβ”€β”€ UI/              # Button, Console, MemoryBlock
β”‚   └── Hub/             # Module selection grid
β”œβ”€β”€ features/            # Feature modules (one per topic)
β”‚   β”œβ”€β”€ gc/              # Garbage Collection
β”‚   β”œβ”€β”€ threads/         # Concurrency
β”‚   β”œβ”€β”€ jit/             # JIT Compilation
β”‚   β”œβ”€β”€ jmm/             # Java Memory Model
β”‚   └── static/          # Static vs Instance
β”œβ”€β”€ hooks/               # Custom React hooks (simulation logic)
β”œβ”€β”€ contexts/            # React Context providers
β”œβ”€β”€ types/               # TypeScript type definitions
└── App.tsx              # Root application component

πŸš€ Getting Started

Prerequisites

  • Node.js 18+
  • npm or yarn

Installation

# Clone the repository
git clone https://github.com/pramithamj/java-masterclass.git
cd java-masterclass

# Install dependencies
npm install

# Start development server
npm run dev

Open http://localhost:5173 in your browser.

Build for Production

npm run build
npm run preview    # Preview production build locally

🌐 Deployment

GitHub Pages

The app is configured for GitHub Pages deployment:

  1. Build the project: npm run build
  2. Push to your repository
  3. Enable GitHub Pages in repository settings (deploy from gh-pages branch or /docs folder)

Note: The base path in vite.config.ts must match your repository name.

πŸ“š Module Details

Garbage Collection Simulator

Visualize the Generational Hypothesis in action:

  • Eden Space: Where new objects are allocated
  • Survivor Space: Objects that survive Minor GC
  • Old Generation: Long-lived objects (tenured)
  • Trigger Minor GC and Full GC to see object lifecycle

Concurrency Simulator

Understand Java's Monitor Lock mechanism:

  • See threads competing for synchronized blocks
  • Watch Entry Set (blocked) and Running states
  • Visualize lock acquisition and release

JIT Compilation Simulator

Watch code get "hot" and tiered compilation kick in:

  • Interpreted: Initial slow execution
  • C1 Compiler: Quick compilation, basic optimizations
  • C2 Compiler: Aggressive optimization (inlining, escape analysis)

Java Memory Model Lab

Understand visibility and happens-before:

  • CPU L1 caches vs Main Memory
  • Volatile writes flush to memory
  • Non-volatile reads may see stale data

Static vs Instance Lab

Visualize where static and instance members live:

  • Metaspace: Class-level static fields (shared)
  • Heap: Per-instance fields (unique per object)
  • See how static changes affect ALL instances

πŸ› οΈ Technology Stack

  • React 19 - UI framework with hooks
  • TypeScript 5.9 - Type safety
  • Vite 7 - Fast build tool with HMR
  • CSS Modules - Scoped styling
  • ESLint - Code quality

πŸ“ Design Principles

  1. Single Responsibility (SRP): Each component/hook has one clear purpose
  2. Open/Closed (OCP): Easy to add new modules without modifying core
  3. Dependency Inversion (DIP): Contexts provide injectable dependencies
  4. Interface Segregation (ISP): Small, focused type interfaces

🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments

  • Inspired by the need for better JVM education tools
  • Built with modern React best practices
  • Designed for developers learning advanced Java concepts

Releases

No releases published

Packages

 
 
 

Contributors

Languages