ELI5: Explain Like I'm 5

Pyramid of doom (programming)

Pyramid of doom is like a tower made of blocks that keeps getting taller and taller. In programming, it happens when you have to write a lot of nested codes (like putting one block on top of the other), and they keep adding up, making your code look confusing and hard to read.

Let's say you have to operate a toy car that has several features like turning on its lights, moving forwards or backwards, and honking the horn. To make the car work, you have to write codes for each of these features.

But, you also want the car to turn left or right. So you have to write codes for those features as well. But, to turn, you have to move the car first. And, to move the car, you have to turn on its engine. To turn on the engine, you have to connect the car to a battery, and this goes on and on.

Now, if you write all of these codes one after another, it will become a pyramid of codes as they will keep getting nested within each other. And, it will become hard for someone to understand what's going on when they read it.

So, programmers always try to avoid such a situation by using techniques like using functions that only do one thing at a time or breaking the code into smaller pieces. This way, the code remains easy to read and understand.
Related topics others have asked about: