I am reading this C++ book, "Problem Solving with C++" in my free time. I have gotten through 4 chapters, and now I am at a split. I can either go to chapter 5 which is file operations and an introduction to OOP, or I can go to chapter 12 which is recursion. So far I have only gone over compiler basics, all that if, else, and loops syntaxy jazz, and both call by reference and call by value functions. The book gives no mention on whether its better to learn recursion, before oop or not, but it does say that some teachers may prefer to teach it that way, and its ok to skip to chapter 12 and go back. I being a novice in both paradigms just wanna know is it benefical for me to learn one before the other.....and yes I plan to learn both so don't be that wise guy.
There's a reason the author of the book put recursion in chapter 12, and not chapter 5.
Disclaimer: This is really a matter of opinion. Having said that, you should learn recursion first.
You must understand recursion whether you learn OOP or not. It's a fundamental chapter.
Recursion and OOP are not mutually exclusive.
i.e. it doesn't matter, whether you learn about recursion first or OOP.
OOP is the way you structure your code.
Recursion is the way to express the solution to a given problem, which could be solved by iteration.
Recursion is a mathematically fundamental concept, but I wouldn't consider it such a key topic in C++ as to make it worth your while to skip over files, OOP, and other very practically useful concepts. An instructor might wish to reorg the chapters/subjects to fit their own teaching style, but, missing an instructor, I'd recommend continuing with the chapters in their natural order (which has to be the order the book authors favored, after all!-) and coming to recursion later, after you have OOP, files &c under your belt.
OOP and recursion are two vastly different things. OOP is much bigger a concept compared to recursion. I suggest you to go by the order in the book. If he is not going to talk about recursion upto chapter 12 then he is not going to use it also. So you will not miss on anything.
i say read chapter 5, whatever the topic is since its the next chapter after 4.
Recursion first. Because you should learn functions before you learn objects. And recursion is mainly about functions.
Recursion has nothing to do with OOP. When teaching Recursion ,people ususal use Fibonacci sequence ; when teaching OOP , people ususally say "a car has four wheels".
I would suggest you go for what is more interesting to you - it seem to be Recursion in this case. Recursion as a foundmental problem solving mothod ,if not more imporatant than OOP , is as important as OOP.
In my personal opinion I would say go with recursion first, but spend more time on oop.
Additionally, if what you are getting at is: will one help you learn the other better- then yes and no.
Yes in that once you learn one in programming, the next thing you learn (even unrelated) will be easier to learn just because you are gaining more and more experience with programming in general.
No in that the order in which you learn these in respect to one another is not important.
The only way to truly understand recursion is to have a problem that is effectively solved by it, and then write the recursive code. One does not learn it in a leisurely manner. Wait until you need it.
Though, hopefully your ah-ha moment for recursion won't be in an interview like mine was.
Recursion first.
Recursion is a very basic and fundamental structure in programming; if you don't know it, you don't yet know the basics of programming.
OOP on the other hand, is a high level code organization methodology.
Learn the low levels first.