Sunday, October 27, 2013

OOP and recursion

I know you're probably thinking I should come up with some clever title but this is the most creative thing I can think of. Also, you can go ahead and thank me for not making fun of the name OOP. I don't even want to know how many people used the word 'oops' in their SLOG.

I did CSC108 last year, which is supposed to give me some advantage or at least prepare me well for CSC148 but boy, was I wrong.

The only programming language I've learnt is Python, which is an object oriented language. This makes it so much more difficult for me to understand what an OOP actually is. There is no comparison.

Thanks to Wikipedia, I have a vague idea of what OOP is. OOPs consist of different objects such as classes, each would manage specific kinds of data. If you assign a method to a class, you can access it and tell it to do what you want it to. This way, it is more flexible and manageable.

Now recursion is something I understand better about. It is a process that repeats itself until we get the result that we want. With a base case, the program will end after that so it doesn't run infinitely. It is very helpful when we can break problems into smaller pieces that have a similar structure as our original problem. To understand it, you have to take that 'leap of faith' and believe that it will work no matter how counterintuitive it is to you. That's what I did anyways.

1 comment: