Mark Pearl

Avoiding Pitfalls

Here are a few suggestions for avoiding common pitfalls when working with recursion.

  • Manipulating large values or complex objects will likely require explicit type, and boundary, checks such as those found within an iterative implementations.
  • Applying simplistic recursive thinking without care may lead to incorrect results and performance issues.
  • Maintaining state within a deep recursive call chain may demand refactoring or workarounds, such as, tail calls.
  • Debugging difficulties that are encountered when using non-trivial recursive methods may dictate logging and perseverance.

References

Rethinking the practicalities of recursion



blog comments powered by Disqus

Want to get my personal insights on what I learn as I learn it? Subscribe now!


/