Sunday, 13 October 2013

Object-Orientation and Recursion

Object-oriented programming and recursion are both key concepts in computer science. They allow for the programmer to simplify and efficiently solve both theoretical and real-world problems.

Object-oriented programming essentially means that a program is being broken down from something general into multiple simpler and smaller parts which are known as "objects". These objects can have attributes which store the properties or state of the object and they can also have procedures or methods which execute certain tasks or perform a certain calculation and allows the objects to interact with each other. Object-oriented programming is the most popular form of computing nowadays because of how well it breaks down large complicated problems into small and manageable tasks.

Recursion is a way of solving a problem which involves repeatedly using a recursive method or procedure. Commonly a method that solves something recursively will break the problem down into its simpler or smaller repetitive parts and apply itself to them. Any recursive method can also be accomplished iteratively but for some cases recursion is more efficient than iteration. For example, when navigating binary trees or solving the Towers of Hanoi problem.

No comments:

Post a Comment