Saturday, October 12, 2013

Topic Question 1

    Object-Oriented Programming (OOP), is very useful for computer scientists. It is a concept that allows for encapsulation of data within specific sections allowing for functions to act as intermediates between what is given and what is wanted. This allows the programmer to structure their program more logically, and have specific controls for what is allowed to happen to specific data. In contrast, non-OOP is just a long script of instructions that may be broken down into sections but in the end it is globally accessible to the whole program and many bugs can appear because there is no rules to what can be implemented on what data (ex. has no methods like OOP does).

    Recursion is a very tricky topic as previously mentioned in a post. It is the idea of formulating a specific set of instructions under a function, however the main focus is that in the body of that function, it uses itself to calculate a variable it needs to use. This allows the programmer to write shorter code, as the functions can keep going back and calculating instead of writing complicated loops. It is used in solving complex ideas, where one output is needed for a second input, etc. Once this complex idea is understood, it is a very powerful tool in computing, saves a lot of time in analyzing data, and in the end is the most efficient way to solve the problems where it is needed rather then trying to incorporate loops and temp. variables, etc.

1 comment:

  1. To get a better feel for recursion, try writing out each step in a recursive function, say the factorial function. And here's a good place to get more practice; http://codingbat.com/

    ReplyDelete