Friday, October 18, 2013
Sunday, October 13, 2013
Object-oriented programming is a
style of programming which a programmer can in a way, figuratively create objects. In
order for a particular object to be useful, the programmer needs to implement
what kind of actions this object can do. The programming term for these actions
is called a method. These methods associated with an object is what makes
object-oriented programming useful in programming because it completes certain
tasks in only a few lines or less in an efficient matter. Also with
object-oriented programming, if one were to create an object that has similar
methods to another, instead of typing each method out again, one can inherit
these methods from some object into their object. This could save a lot of
time, and could save a lot of problems if the object being inherited from has
already been debugged with no other problems found. If someone decided not to
inherit and type each individual method, there would have to be multiple checks
to make sure this object has been made perfectly without any bugs.
Recursion is a method of
programming that’s used to get to a final solution that comes from solutions of
a reoccurring problem. It’s easy to label such a method as recursion since you
can find that the recursion method has a base case which produces a single answer, then if the conditions of the base case isn’t satisfied, the
method will call itself otherwise in order to get to the base case and produce
a final solution. Recursion becomes very useful for problems that tend to be repetitive
in its design such as finding the depth of a nested list. If a list in a nested
list contains more lists of lists, it can be thought to be a solution with many
lines of code, but with recursion can be reduced to only 1 line of code. With
this type of method, we could take something that could go on an infinite amount
of times given a large example, and turn it into a finite answer, which came from the solutions of smaller problems.
Subscribe to:
Posts (Atom)