Home Segments Top Top Previous Next

457: Mainline

Many mathematically oriented programmers prefer recursive definitions to iterative definitions, when both are possible, believing that there is inherent elegance in defining a method partly in terms of itself.

Other, practically oriented programmers dislike recursive definitions for one or both of two reasons. First, the recursive approach usually produces much slower programs, because each method call takes time. Second, the recursive approach may have problems with large arguments, because the number of method calls in a recursive chain of calls is usually limited to a few hundred.

Recursion aficionados counter by creating compilers that handle certain recursive methods in sophisticated ways that avoid such limits.