Design patterns·The named ways it goes wrong
the code drifts right for six levels and back again, and the shape of it on screen is a wide arrowhead.
Arrow anti-pattern
Also calledpyramid of doom, arrow code, deep nesting
Deeply nested conditionals whose indentation forms an arrow, where the meaningful line is buried at the deepest point and every closing brace is unlabelled. It is a readability problem with a mechanical cure: guard clauses for the failure cases, and extracted methods for the nested blocks that remain. Each level of nesting is roughly another condition a reader must hold in their head, which is why it stops being readable at about three.