Advent of Code is an annual set of Christmas-themed computer programming challenges that follow an Advent calendar.
-
Improve Java programming skills: Master modern Java features (Java 25), SOLID principles, Effective Java best practices, and clean code techniques
-
Functional Programming & Design:
- Sealed Interfaces & ADTs: Type-safe algebraic data types for pattern matching
MathOperatorwith sealed interface and record implementationsInstructionsealed interface for virtual machine instructionsInstructionsealed interface for Turing machine
- Records: Immutable data carriers for state representation
- Streams API: Declarative data transformations,
Stream.iterate()for functional iteration, lazy evaluationRange2,ShapePackingTrampoline.run()usesStream.iterate()for iterative evaluation
- Pattern Matching: Switch expressions with sealed classes for exhaustive type checking
Instruction.from()uses switch expressions for instruction parsing
- Trampoline Pattern: Converting deep recursion to iteration, preventing stack overflow
Trampolinesealed interface withDoneandMorerecordsAssembunnyInterpreteruses trampoline for safe deep recursionContainerCombinationuses trampoline for backtracking
- Pure Functions: Side-effect-free transformations, immutable data structures
Interval.contains(),Range2.mergeIntervals()- State transformation methods like
ProgramState.withRegisters()
- Higher-Order Functions: Function composition, method references, lambda expressions
- Parallel Processing: Parallel streams for independent computations
ShapePackingwithparallelStream()for region processing
- Sealed Interfaces & ADTs: Type-safe algebraic data types for pattern matching
-
Data Oriented Programming (DOP):
- Code-Data Separation: Instructions as data structures, execution logic separated from instruction representation
Instructionsealed interface separates instruction data from execution logicInstructionfor Turing machine instructions
- Generic Data Structures: Flexible, reusable data representations
- Generic
Trampoline<T>for any computation type
- Generic
- Immutable Data: Records and sealed interfaces ensure data integrity
RangeProblemInput,GraphNode,GraphEdgeProgramStatewithwithRegisters()andwithProgramCounter()transformation methods
- Pure Data Manipulation: Transformations through pure functions, explicit data flow
- Flat Data Models: Denormalized structures for efficient processing
- Interleaved Arrays: Better cache locality for related data pairs
RationalMatrixwith interleaved numerator/denominator storage
- Code-Data Separation: Instructions as data structures, execution logic separated from instruction representation
-
Algorithms & Data Structures:
- Graph Algorithms: BFS (Breadth-First Search), DFS (Depth-First Search), Dijkstra's shortest path, A* pathfinding with heuristics, memoized path counting (e.g.,
GraphPathCounter) - Dynamic Programming: Memoization for overlapping subproblems, optimal substructure exploitation (e.g.,
GraphPathCounter,BeamPathCounter) - Backtracking: Recursive search with pruning, constraint satisfaction (e.g.,
ShapePackingwith bitmask optimization) - State Space Search: BFS/DFS for exploring solution spaces
RamRunBFS pathfinding,LavaHikingTrails2BFS trail exploration,KeypadConundrum2BFS shortest paths,LavaHikingTrailsDFS trail rating,LanPartystate-based Bron-Kerbosch algorithm- Elevator puzzles with state space search
- Range Algorithms: Range merging, interval operations, coverage calculations (e.g.,
Range2,Interval) - Tree Traversal: File system navigation, hierarchical data processing
- String Algorithms: Pattern matching, parsing, validation, hash generation
- Grid Algorithms: 2D matrix manipulation, neighbor checking, cellular automata, pathfinding in grids (e.g.,
GridNeighbor2,BeamPathCounter) - Union-Find (DSU): Disjoint Set Union for connected components with path compression and union by size (e.g.,
DSUinPointCluster3) - Meet-in-the-Middle: Split-and-combine approach for exponential problems (e.g.,
Part1Solverwith Gray Code optimization) - RREF (Reduced Row Echelon Form): Linear algebra for constraint optimization (e.g.,
RationalMatrixinPart2Solver) - Bitmask Optimization: Efficient 2D grid representation with O(1) bitwise operations (e.g.,
ShapePacking,ShapeVariant) - Primitive Collections: FastUtil and Eclipse Collections for performance-critical code (e.g.,
ObjectArrayList,LongIntHashMap) - Optimization Techniques: Big O analysis, complexity optimization, space-time tradeoffs, parallel execution
- Virtual Machine Implementation: Instruction-based execution with state management
AssembunnyInterpreterwith trampoline-based execution- Turing machine implementation with sealed instruction types
- Graph Algorithms: BFS (Breadth-First Search), DFS (Depth-First Search), Dijkstra's shortest path, A* pathfinding with heuristics, memoized path counting (e.g.,
- Unit Testing: Comprehensive test coverage with JUnit 5
- JMH Benchmarks: Performance benchmarking for algorithm comparison
- Run benchmarks:
./mvnw clean test -Pbenchmarks -Dtest=DayXBenchmarkTest -D2025-dayX-benchmark=true -Dsurefire.failIfNoSpecifiedTests=false -pl 2025 -am - Available for Days 1, 2, 4, 5, 6, 8 (2025)
- Run benchmarks:
- Java Flight Recorder: Profiling data included in benchmark results
- Performance Analysis: See Big O Notation Documentation for complexity analysis
- https://openjdk.org/projects/code-tools/jol/
- https://jmh.morethan.io/
- https://inside.java/2024/05/23/dop-v1-1-introduction/
- https://adventofcode.com/
- https://www.reddit.com/r/adventofcode/
- https://www.reddit.com/r/adventofcode/?f=flair_name%3A%22Funny%22
- https://www.reddit.com/r/adventofcode/?f=flair_name%3A%22Visualization%22
- https://www.reddit.com/r/adventofcode/search/?q=flair_name%3A%22SOLUTION%20MEGATHREAD%22&restrict_sr=1
- https://github.com/forax/advent-of-code-2025
A heartfelt thanks to Frontier models for the insightful early morning (6:00 AM) discussions on design thinking and code refactoring, with a focus on functional approaches. I'm also deeply grateful to my friend Juan Antonio Medina for the continuous and inspiring conversations throughout the day, and to Rene van Putten for their invaluable inspiration.