Definition:
Graceful Degradation is a design principle where a system continues to function at a reduced level when part of it fails β rather than breaking completely.
The goal is to keep core functionality alive, even when things go wrong.
Simple Analogy π A house with a backup generator β when the main power goes out, you donβt lose everything. You still get lights and the fridge running, just not the full power grid.
Visual Concept
All features working β Some features fail β Core still works [ β Full Experience ] [ β οΈ Degraded ] [ π΄ NOT broken ]
Example:
Imagine an e-commerce website where a recommendation service goes down.
With Graceful Degradation:
User visits product page
β
Calls Recommendation API β β API timeout / down
β
Fallback: Show static "Popular Items" list instead
β
Page still loads, user still shops ποΈ
async function getRecommendations(userId) {
try {
const res = await fetch(`/api/recommendations/${userId}`);
return await res.json();
} catch (error) {
// π Graceful fallback when service is down
return getStaticPopularItems();
}
}
**More Quick Examples**
| Scenario | Failure | Graceful Response |
| ---------------- | ------------------ | ------------------------------------------ |
| πΊοΈ Maps app | Network slow | Show cached map tiles already downloaded |
| π§ Web email | Offline | Still let user draft/edit emails |
| π΅ Streaming app | CDN issue | Drop video quality, don't stop playback |
| π Website | JS fails to load | Page still readable as plain HTML |
**Graceful Degradation vs Fault Tolerance**
| Aspect | Graceful Degradation | Fault Tolerance |
| ---------- | ---------------------------- | -------------------------------------- |
| On failure | Reduced functionality | No impact, seamless |
| Goal | Keep core alive | Zero downtime |
| Example | Show cached data | Automatic failover to backup server |