# Facade Design Pattern — Java Example **Pattern:** Structural → Facade **Article:** https://ankurm.com/facade-design-pattern-java/ ## What this example shows A video-conversion subsystem (`VideoFile`, `Codec`, `MPEG4CompressionCodec`, `OggCompressionCodec`, `CodecFactory`, `BitrateReader`, `AudioMixer`) is wrapped behind one class, `VideoConversionFacade`, that exposes a single `convertVideo()` method. Callers never touch the six subsystem classes directly, but they remain public and usable on their own for advanced use cases. ## How to run ```bash javac facade/*.java -d out/facade java -cp out/facade facade.Main ``` Requires Java 25. ## Post Section ↔ File Mapping | Post Section | File(s) | |---|---| | The Subsystem (Complex, But Unchanged) — VideoFile | `VideoFile.java` | | The Subsystem (Complex, But Unchanged) — Codec interface | `Codec.java` | | The Subsystem (Complex, But Unchanged) — Concrete Codecs | `MPEG4CompressionCodec.java`, `OggCompressionCodec.java` | | The Subsystem (Complex, But Unchanged) — CodecFactory | `CodecFactory.java` | | The Subsystem (Complex, But Unchanged) — BitrateReader | `BitrateReader.java` | | The Subsystem (Complex, But Unchanged) — AudioMixer | `AudioMixer.java` | | The Facade | `VideoConversionFacade.java` | | Client Code: One Line | `Main.java` | Note: the SLF4J `LoggerFactory`, JDBC `DriverManager`, and Spring `JdbcTemplate` snippets under "Facade in the JDK and Real Frameworks" are illustrative only — they are not part of this repository's runnable example. Article: https://ankurm.com/facade-design-pattern-java/ All patterns: https://ankurm.com/design-patterns-java/