One Job, Bro! – Mastering the Single Responsibility Principle
Ever seen a class that does everything from cooking biryani to flying rockets? 🚀🍛 That’s exactly what the Single Responsibility Principle (SRP) tells us to avoid!
👨🏫 **Definition:** SRP states that a class (or function/module) should have only ONE reason to change. That means it should only do ONE job. One class = One Responsibility = Peace of mind.
🛠️ **Real-Life Examples:**
- A **washing machine** should wash clothes, not fry samosas.
- A **cashier** at a shop shouldn’t also be responsible for cleaning the floors, managing stock, and DJing at the weekend party.
- A **coffee machine** that makes tea, photocopies your ID, and launches missiles? Red flag! ☕🚫💣
🎯 In this quiz, you’ll:
- Learn to refactor multipurpose monster classes
- Spot violations of SRP in sneaky code
- Improve cohesion and reduce coupling like a boss
By the end, you’ll code like a craftsman, not a kitchen sink architect. Let’s gooo! 💥💻