Wednesday 22 January 2014

Object Oriented Programming (OOP)

Essentially with OOP we can do anything.
Well... almost anything.

Object oriented programming allows us to create an object with special properties (a.k.a attributes) and methods (stuff that we make the object do). OOP is a way of structuring a program.

In order to create such an object, we first have to create the class (or "blueprint"). This class outlines all the methods and special attributes the object possesses.

For example: Lets make a baby. Below is an example of a program that contains the blueprints to creating a baby.



OOP is an interesting and fun way to program in python. Writing an OOP is similar to storytelling. As the programmer, you create objects and what they can do. You can choose what objects interact with each other and what properties they have. AS the programmer you control everything. 


Week 2: Recursion

This week's class we learnt about the concept of recursion.
It's pretty interesting.
Essentially recursion is a function that calls itself in order to complete whatever task you desire.

In order to use recursion there has to be:

  • a pattern or specific sequence that repeats it self.
  • a base case so the computer knows where to start.
  • a function that does something

The concept of recursion is not too difficult to understand, but its not as simple as it looks.
This stuff gets pretty confusing when you have some whacky sequence. 

Creating a recursive function ezpz once you get the base case, luckily if you're good with recognizing patterns you can get that base case. Unfortunately I am not that person.

Week 1 in CSC148

Greatest achievement of the new semester: showing up to class.