I always thought things that make your code uneasy to follow while being avoidable are considered as Bad Practice. Recursion seems to be one of these things (not to mention the problems it can cause like stack overflowing etc.), so I was a bit surprised when we had to learn working seriously with them during a programming course (for it ocassionally results in shorter code). And it seems to me there is a disagreement about it between the professors too...
People already asked this specific to languages (like Python, where a comment compared it to a goto
statement), mostly specific to a problem, but I am interested in general:
Is recursion considered as a Bad Practice or not in the modern programming? When should I avoid it, and are there any circumstances when can't?
Related questions I found:
Is recursion a feature in and of itself? (does not discuss whether it is good or bad)
Is recursion ever faster than looping? (answer describes that recursion can result in improvements in functional languages, but is expensive in others), also other questions discussing the performance