đź“…Week-4 (Day-2) - Simplifying Design: Facade Pattern with Real-World Code and Use Case


NOTE: - I started my 8-week system design journey with Coder Army. I will be journaling every day, recording what I learn, reflecting on it, and sharing it with my network to help newcomers to system design.
đź’ What is the Facade Design Pattern?
The Facade Pattern provides a simplified, unified interface to a set of complex subsystems. It hides system complexity and only exposes what's necessary.
(Hindi: Facade Pattern ek simplified aur unified interface provide karta hai jo kai complex subsystems ke upar kaam karta hai. Ye system ki complexity ko chhupa deta hai aur sirf wahi cheezein dikhata hai jo zaroori hoti hain.)
đź’ Facade vs Adapter
Facade: Hides complexity
Adapter: Bridges two incompatible interfaces
đź’ Real-Life Analogy
💻 Booting up a computer When you press the power button on your laptop, you don’t manually:
Start the power supply 🔋
Cool the system ❄️
Load the BIOS ⚙️
Spin up the hard disk đź’˝
Boot the OS đź’»
➡️ Instead, the power button does all that for you. That's Facade Pattern in real life — it hides complexity behind a simple interface!
đź’ Principle of Least Knowledge (Law of Demeter)
"Talk only to your immediate friends." A class should only call methods of:
Itself (this object)
Objects passed in as parameters
Objects it creates inside
Its direct components (HAS-A relationship)
đź’ˇ This reduces dependency and keeps the system loosely coupled.
đź’ Subsystems in Our Example:
PowerSupply
🔋CoolingSystem
❄️BIOS
⚙️HardDrive
đź’˝OperatingSystem
🖥️
These components work together to boot up a computer.
// Subsystems
class PowerSupply {
public void providePower() {
System.out.println("Power Supply: Providing power...");
}
}
class CoolingSystem {
public void startFans() {
System.out.println("Cooling System: Fans started...");
}
}
class CPU {
public void initialize() {
System.out.println("CPU: Initialization started...");
}
}
class Memory {
public void selfTest() {
System.out.println("Memory: Self-test passed...");
}
}
class HardDrive {
public void spinUp() {
System.out.println("Hard Drive: Spinning up...");
}
}
class BIOS {
public void boot(CPU cpu, Memory memory) {
System.out.println("BIOS: Booting CPU and Memory checks...");
cpu.initialize();
memory.selfTest();
}
}
class OperatingSystem {
public void load() {
System.out.println("Operating System: Loading into memory...");
}
}
// Facade
class ComputerFacade {
private PowerSupply powerSupply = new PowerSupply();
private CoolingSystem coolingSystem = new CoolingSystem();
private CPU cpu = new CPU();
private Memory memory = new Memory();
private HardDrive hardDrive = new HardDrive();
private BIOS bios = new BIOS();
private OperatingSystem os = new OperatingSystem();
public void startComputer() {
System.out.println("----- Starting Computer -----");
powerSupply.providePower();
coolingSystem.startFans();
bios.boot(cpu, memory);
hardDrive.spinUp();
os.load();
System.out.println("Computer Booted Successfully!");
}
}
// Client
public class FacadePattern {
public static void main(String[] args) {
ComputerFacade computer = new ComputerFacade();
computer.startComputer();
}
}
đź’ Real-Life Facade Examples:
🏠Home Automation: One button to turn off lights, lock doors, and activate security.
🎮 Game Console: One button powers on the screen, audio, and console.
🎬 Media Player: One button to load movie, subtitles, and audio settings.
📚 Summary
Facade Pattern kya karta hai?
Complex system ke upar ek simple interface deta hai jisse use karna easy ho jata hai.
Kab use karein?
Jab system ke multiple components ho, aur aap client ko sirf ek simple method dena chahte ho.
Kaise kaam karta hai?
Ek Facade class banao jo sare subsystems ko internally control kare. Client sirf usse interact kare.
Example: Computer ko ON karne ke liye sirf power button dabana — that’s Facade Pattern!
Week - 4 ( Day-2) Completed âś… System Design
NOTE : - A big thanks to my mentors Rohit Negi Sir and Aditya Sir for launching this amazing 8-week course absolutely free on YouTube via CoderArmy9 :- youtube.com/@CoderArmy9 . 🙌
👉 Share this blog with your connections! Let’s keep learning, growing, and supporting one another on this journey. 🚀
✍️ Payal Kumari 👩‍💻
Jai Hind 🇮🇳 | #CoderArmy #LearningInPublic #SystemDesign #TechForAll #MentorshipMatters #8weeksLLdChallenge #LowLevelDesign #Code #LLD #OOP 👩‍💻
Subscribe to my newsletter
Read articles from Payal Kumari directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by

Payal Kumari
Payal Kumari
I'm a passionate full-stack developer with a strong foundation in the MERN stack—building and maintaining scalable web applications using React.js, Node.js, and Next.js. My journey in open source began with Hacktoberfest 2023, where I made four impactful pull requests that sparked a love for collaborative coding, global learning, and open knowledge sharing. Since then, I’ve contributed to and mentored projects in top open source programs like GSSoC’24, SSOC’24, and C4GT’24. As a Google Gen AI Exchange Hackathon ’24 Finalist and Google’s Women Techmakers (WTM) Ambassador, I’ve been privileged to support diverse communities in building meaningful tech solutions. My work as a Top 50 Mentor for GSSoC ’24 reflects my commitment to nurturing new talent in tech. Beyond development, I serve as a Student Career Guide, Profile Building Expert & Evangelist at Topmate.io, where I conduct workshops, guide students through resume building and career strategy, and help mentees navigate open source and tech careers. Recognized among the Top 5% of mentors and featured on “Topmate Discover,” I take pride in making mentorship accessible and impactful. My technical voice has also been acknowledged by LinkedIn, where I’ve earned the Top Voice badge seven times in domains like web development, programming, and software engineering. In addition, I hold LinkedIn Golden Badges for Research Skills, Interpersonal Skills, Critical Thinking, and Teamwork—signaling a well-rounded approach to both individual contribution and team collaboration. Graduating with an MCA from Chandigarh University in 2023, I’ve continued to fuel my curiosity by writing technical articles and sharing practical MERN stack insights across platforms. Whether it’s building polished UIs, optimizing backend performance, or guiding a mentee through their first pull request, I’m driven by the power of community and continuous learning. Let’s connect! I'm open to collaborations, mentorship, or building something impactful together. Reach out to me at kumaripayal7488@gmail.com or visit my profile on Topmate.io.