Wednesday, January 29, 2014

Week of Jan.26.2013

This week we went over a little more recursion, and learned about inheritance in our class.  Luckily for me I am familiar with inheritance, but recursion was always a difficulty of mine to trace.  Recursion can be thought of as a piece wise function, where the base case is the case where the function stops calling itself, and begins to return the value from the previous function call until the function finally returns a final value.  One example can include a factorial function, where as the base case where if the input x is 0, the function returns 1, otherwise multiply the input with the function call input x-1.

Sudocode:

if x = 0 => 1
else => x*f(x-1)


def factorial(x):
    if x == 0:
        return 1
    else:
        return x*factorial(x-1)

     

Monday, January 20, 2014

Week of January.16.2013

Before we get started, I wanted to quickly brief about what Object Oriented Programming, otherwise known as OOP.  An object is made up of a class, which contains properties and methods that can be used to change change certain properties of that object, or actions that the object can do.  For instance, if I have a class that that simply creates a fraction of a numerator and denominator, I can simply make methods to calculate the improper fraction for that instance of the object, or the mixed fraction of the fraction.

I have been taking computer science courses since I was in grade 10, that being said I never started taking computer science seriously since grade 11, due to the fact that we were learning an obsolete language at the time (Turing).  Nonetheless, one of the most important things I have learned at my high school was Object Oriented Programming (Otherwise known as OOP).  It made programming 70% more efficient and creating programs significantly faster.  I never realized the power of OOP before I first started using it, and have since then had tremendous amount of experience programming with OOP using Java.  OOP with Python is not a huge difference from Java, has the same idea, with a few syntax differences.  Other then that, I would like to add that I was very fortunate that Computer Science was offered at my school, and I wouldn't be here today if I had no taken it there.  Cheers!