Win a copy of Programming with Types this week in the Angular and TypeScript forum
or The Design of Web APIs in the Web Services forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Knute Snortum
  • Henry Wong
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Frits Walraven
  • Joe Ess
  • salvin francis

recursion phobia

 
Ranch Hand
Posts: 4702
9
Scala Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why are so many people deathly afraid of recursion? check out the first repy to my post in threads forum http://www.javaranch.com/ubb/Forum27/HTML/000317.html
no disrespect intended but
its no more "dangerous" than while(true)
and I will use either if thats what works best
 
Ranch Hand
Posts: 1012
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i love recursion! once i got the hang of it a few semesters ago in a c++ class i have used it whenever possible. however, before i figured it out, i stayed away.
a wise man once said: "we fear that which we do not understand."
i used recursion in my last program for the cattle drive. marilyn's pick was that recursion is cool, but later down the road someone modifying your code might not understand what is going on. i can understand that, and i suppose the while( true ) statement i replaced it with is more "in your face".
however, she also hinted that the loop was better in that situation because it would only be called 3 times... if the method needs to be called numerous times, i would think recursion would be better... correct me if i am wrong.
 
Squanch that. And squanch this tiny ad:
Sauce Labs - World's Largest Continuous Testing Cloud for Websites and Mobile Apps
https://coderanch.com/t/722574/Sauce-Labs-World-Largest-Continuous
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!