Thursday, 24 October 2013

Midterms and class this week

Last week on Wednesday we had our midterm for the course which proved to be not as easy as I had expected. I was pretty confident going into the midterm since I have a lot of experience in computer science and most of the content we cover is review for me. I made a page long aid sheet with just the names of the python methods for basic classes like List, String, etc. since I'm completely new to Python as of taking this course. I ended up not even using it once during the test because I didn't really need to use anything that I put on it. One thing I didn't know was what the how min() method determined which tuple was the smallest. I guessed how it worked and then I checked when I got home and it looks like I got it right. One thing I forgot about on the test was how to create a copy of a list. I was able to find a workaround that still ended up working when I checked so hopefully I don't lose any marks for having a "less correct" way of implementing it. Other than those two issues above I pretty much found the rest of it fairly easy. I'll have to wait to see what mark I get next time I got to class.

This week I didn't go to any of the lectures mostly due to staying up too late and sleeping in. This was fine by me because I'm mostly self-taught when it comes to computer science and I figured I'd be able to catch up just fine. It surprised me when I went to the lab today and I for once didn't know something that we were working on! We had to implement a Linked List which I had never heard of before and since I didn't go to the lectures I had no idea what was going on. Luckily the slides from this week were posted online so I was able to quickly read through those and check online to figure out how they worked. After that I found linked lists to actually be quite interesting and learning something new was also quite fun. I was still able to finish the lab without much difficulty and was able to leave 15 minutes early too!

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.