N
N
nepster-web2016-11-28 11:27:35
Programming
nepster-web, 2016-11-28 11:27:35

What is your take on recursion?

Somewhere around 5 years ago, I had a dubious opinion about recursions.
However, there has been a growing need for them lately.
For example, if you have an ar-object with many relations in 3 or 4 nestings and there is a task to wrap this whole thing in collections. That is to wrap each record of nested relations in collections.
This is where recursion comes into play. Will its use be justified here and is there any point in using them or avoiding them anyway?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
S
Saboteur, 2016-11-28
@nepster-web

Recursion is a great solution for single tasks. Same as using case instead of if, or using sql instead of data arrays.
Just use them where recursion works better than other solutions and that's it. There are many tasks where recursion would be best practice.
As for the fact that "it doesn't work well in some languages", you won't know until you try it.

G
GavriKos, 2016-11-28
@GavriKos

What is your take on the freezer? Somewhere about 5 years ago there was a dubious opinion, but now I buy dumplings more and more often and they need to be stored somewhere.
In short, the question is crazy. If recursion makes it easier for you to solve a problem, feel free to use it.

P
protven, 2016-11-28
@protven

My attitude to recursion is exactly the same as to recursion.

R
Roman Kitaev, 2016-11-28
@deliro

Recursion is a beautiful evil. It's best to avoid it, but sometimes you can.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question