Last year, while watching coverage of the Tour de France, Stephan M noticed something a little strange. If he tilted his head by 90° and squinted just a bit, the profile maps showing the peaks and valleys of the mountain stage looked rather familiar. They were just like the monstrous routines written by his predecessor - the very same coder behind the Quadrasort.

"Following is a stripped down version of an almost 700 LoC method in Java," wrote Stephan," I removed anything except the control flow statements, so that you can grasp the full beauty of this masterpiece.

 

public boolean foo() {
    try {
        synchronized () {
            if () {
            } else {
            }
            for () {
                if () {
                    if () {
                        if () {
                            if ()
                            {
                                if () {
                                    for () {
                                    }
                                }
                            }
                        } else {
                            if () {
                                for () {
                                    if () {
                                    } else {
                                    }
                                    if () {
                                    } else {
                                        if () {
                                        }
                                    }
                                    if () {
                                        if () {
                                            if () {
                                                for () {
                                                }
                                            }
                                        }
                                    } else {
                                    }
                                }
                            } else {
                            }
                        }
                    }
                }
            }

            if () {
            }
            if () {
                for () {
                    if () {
                        if () {
                            if () {
                                if () {
                                    if () {
                                        for () {
                                        }
                                    }
                                } else {
                                    if () {
                                        for () {
                                            if () {
                                            } else {
                                                if () {
                                                }
                                            }
                                        }
                                        if () {
                                            if () {
                                                if () {
                                                    for () {
                                                    }
                                                }
                                            }
                                        } else {
                                        }
                                    }
                                }
                            } else {
                                if () {
                                    for () {
                                        if () {
                                        } else {
                                            if () {
                                            }
                                        }
                                    }

                                    if () {
                                        if () {
                                            if () {
                                                if () {
                                                    for () {
                                                    }
                                                }
                                            } else {
                                                if () {
                                                    if () {
                                                        for () {
                                                        }
                                                    }
                                                } else {
                                                    if () {
                                                        for () {
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    } else {
                                    }
                                } else {
                                }
                            }
                        }
                    }
                }
            }
            if () {
                for () {
                    for () {
                        if () {
                        } else {
                            if ()
                            else
                        }
                    }
                    if () {
                        try {
                        } catch () {
                        }
                    }
                }
            } else {
            }
            if () {
            } else {
                try {
                    if () {
                        for () {
                            if ()
                            else
                        }
                    }
                    if () {
                        for () {
                        }
                    }
                    if () {
                        for () {
                        }
                    }
                    if () {
                        for () {
                        }
                    }
                    if () {
                        for () {
                        }
                    }
                } catch () {
                }
                if () {
                    for () {
                        try {
                            if ()
                            else
                        } catch () {
                            try {
                            } catch () {
                            }
                        }
                    }
                }
            }
            try {
            } catch () {
            }
            if () {
                if () {
                    for () {
                        if () {
                            for () {
                                if () {
                                } else {
                                    if ()
                                    else
                                }
                            }
                            if () {
                                try {
                                } catch () {
                                }
                            }
                        }
                    }
                }
            }
            if ()
            try {
            } catch () {
            }
            if () {
                if () {
                    for () {
                        if () {
                            try {
                            } catch () {
                            }
                        }
                    }
                }
            }
            if ()
            return ();
        }
    } finally {
    }
}
[Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!