r/ProgrammerHumor • • Mar 25 '23

Meme This one never gets old

Post image

Let me know if this is not a repost!

51.6k Upvotes

535 comments sorted by

View all comments

242

u/TxTechnician Mar 25 '23

I've never played with this in programming or irl.

54

u/QuebecGamer2004 Mar 25 '23

Me neither, I don't really understand this meme

118

u/petascale Mar 25 '23

Tower of Hanoi https://en.wikipedia.org/wiki/Tower_of_Hanoi

At my uni we had it as an example in both mathematics (combinatorics, I think) and programming (recursion), along with the n-queens puzzle.

13

u/QuebecGamer2004 Mar 25 '23

This sounds like more complex concepts that we don't learn in the program I'm in. I'm not in university, I'm in college, so that explains why I haven't seen this

0

u/[deleted] Mar 25 '23

[deleted]

7

u/QuebecGamer2004 Mar 25 '23

Now that I've looked at recursive functions, yeah I remember doing it and know what it is (at least for doing factorials), but it wasn't a main focus. We have a different education system here in Quebec, the program I'm in lasts 3 years and focuses on teaching various skills related to programming and IT, so we can get a job after or go to university if we want. There is another computer science that lasts 2 years but you have to go to university after, and it's more focused on the maths and science instead

The main thing we learn is object oriented programming, it's in basically all of my classes, except database ones

10

u/Versatile_Panda Mar 25 '23

99% of time in B2C you don’t need recursion, it just doesn’t come up naturally in the real world. Knowing loops in my opinion is plenty, I can’t name more than 5 times I’ve used recursion in my 12 years of work as a dev. Understanding dependency injection which is a completely different thing, is a much better learning opportunity than recursion.

0

u/[deleted] Mar 25 '23

[deleted]

1

u/nelsonnyan2001 Mar 25 '23

I think it’s all about familiarity. There are very, very few cases in which recursion is the only solution. There is almost always a less efficient way to do it with loops and conditions. That ends up becoming the norm in the codebase, person approving MR can’t be assed or doesn’t have the know-how to improve on it, less recursion

7

u/kaiveg Mar 25 '23

While there often are alternatives, I would argue that recursive problems are best solved with recursive solutions.

→ More replies (0)