Sunday 5 April 2015

WEEK 12 ~ Review, Review, Review

     With exams only days away it's easy for me to get overwhelmed with all that I need to study for. It is stressful to think that we are not allowed to have any aid sheet during the final exam because I have become quite used to having one around when doing my labs and assignments, and most importantly when writing the midterms. It's easy to think that memorizing everything is the only way I can pass but, without an aid sheet, I am sure that the final exam will be much more focused on coding that shows our conceptual understanding, as it should. Personally, I do like that format of the midterms and I wouldn't mind being tested in that same way (of course with much more time than just 50min!). I am so glad that our exam for this course is at the end of the month because I need all the time I can get to review, review, review!

     I mainly need to study recursion and binary trees because I think dedicating my time to those two topics will help me improve my coding in other topics like sorting and mutation.

     We were told that the if we have a strong grasp of the type of coding needed to understand and complete all the labs then we have what it takes to do well on the final. I think I could have worked harder during the lab period and have better results on my quizzes that I did poorly on (because we could not finish the labs on time). I cannot afford a low mark for this final and I must work hard throughout this month. I made a study plan for working on the labs each week (doing as much as I can) and then starting to review the exams a week before the final. My idea is that if I practice throughout the month I'll be better at remembering the methods I can use for new problems, rather than reviewing it all in one sitting. My exams for other courses are not back to back so I have chance to make this study method work!

    All the best to everyone!

Saturday 28 March 2015

WEEK 11 ~ Looking Back...

     


   
     One more week and we are done! In the past ten weeks we have covered these topics:

1. Abstract Data Types (i.e. general concepts of built-in functions, methods, graphs, queues, stalks.)
2. Classes and Subclasses (i.e.  general concepts of OOP, inheritance, special methods)
3. Test Cases (i.e. doctests, unittests, assertions, raising errors)
4. Intro to Recursion (i.e tracing)
5. Intro to Tree class and methods (i.e. general concepts, BTNodes, implementing recursion)
6. Binary Search Trees (i.e general concepts, inorder/preorder/postorder)
7. BST Mutations (i.e insert and delete methods)
8. LinkedLists (i.e. general concepts, LTNodes, iteration, mutation)
9. Sort methods (i.e. bubble sort, selection sort, insertion sort, quick sort, merge sort)
10. Raising Errors (i.e. NotImplementedError, AssertionError)

     Looking back I realize I know more conceptually than I do when I start implementing it in code (as seen through doing the labs) and this discrepancy has been consistent throughout the term (thus the quote above by Donald Knuth). In fact, I need more practice in a bulk of these topics strictly because of my overconfidence that I understand the concept. Every week I have been telling myself enough practice will help me improve - which it has - but without help on the labs it's been really hard to keep up. My answers differ from the one's in the lab solutions and, often times, from the answers taken up in class. The only advice I have for myself at this point is to continue doing as much as I can alone and then asking for help when I am really stuck.

     Particularly, my biggest problem is still recursion. Between weeks 6 and 7 I thought I had finally nailed recursion after doing the labs and class exercises on my own but as the weeks went on and the BSTs and LinkLists got more complex I started to get stuck on recursion again. I did refresh my knowledge of recursion, trees, and general classes before our second midterm on week 9 - which I had some confidence going into (having made silly coding mistakes here and there) - but without our marks for that test and the last assignment I do not know where I am at. Some of the topics above have been covered in Intro to Programming last semester but this course is a big jump from that.

    I've noticed - from reading other blogs - that I lot of other students have also had a hard time with the assignments as I have and have consequentially spent more time working on the assignments than on lab exercises. It has also been hard for the bulk of us to work without the help our TAs because of the strike, but I still do recognize that a lot of students work together outside of class to get work done. This is something I should consider doing because I've mostly been working alone this term and nevertheless I do see that I improve when I work with others.

     On that note, I'll end off by saying that we are at the last stretch of the course and if there is any good time to make a change in personal work ethics it is right now. It's worrisome to think the course is pretty much over and this last assignment and exam is the my final chance to bring my marks up. Nevertheless, I'm sure we can all do it.

     Cheers

Sunday 22 March 2015

WEEK 10 ~ Assignment 2 Overview & Assertion

     The second assignment was taken up this week and we were able to see examples on strategy minimax. This helped clarify the bugs we were having trouble with when we were doing the assignment. It did help to take it up in class instead of just the feedback online because other students got to ask questions and share their ideas about their strategies.

     In addition to reviewing the assignment we were also introduced to the assertion which, when used well, can help make coding and debugging easier. We implemented assertion on previous functions which helped show it's practical use to an extent. I will still need some more practice debugging and a bit more clarification on how to implement it before I start the assignment.

     Cheers.

Saturday 14 March 2015

WEEK 9 ~ BSTs & LinkedLists

     

     Working with BSTs and LinkedLists are actually quite interesting. I noticed from doing the labs that there are many ways for iterating over the same trees and still getting the same results. However, this also means that the order in which the trees are iterated over effects the order of the results. This part was a bit challenging for me when working with BSTs. It was challenging for me to return the nodes of a tree in order from smallest to largest (or vice versa) without using the sort method. The only method I can think of is iterating over the nodes until the smallest is found (and then returning it in a list) and then re-iterating over the tree in the same way until all the nodes are listed from smallest to largest. 

     For LinkedLists it was a tad bit harder than just working with BSTs. This is only because we are working with two classes at the same time; LLNode and LinkedLists. Being able to add in new nodes using LLNode is helpful but I still tend to mix up some of the objects between the two classes (self.value and self.data). 

     Nevertheless, there are so many ways to mutate a LinkedList and I hope to be able to master the techniques shown in class for this week (i.e. insert and delete). 

     Cheers
   
     P.S It's the ultimate Pi Day today!!! 3.14.15 !!!

Friday 6 March 2015

WEEK 8: Here We Go Again...


     Okay, this week did not go as planned. I hoped to be able to finish my work early and review lecture material so that I can do this week's lab. Unfortunately, that didn't work out. Instead, I gave most of my attention to the latest assignment that was due yesterday. My partner and I didn't meet the assignment requirements thoroughly but we got as much done as we could with the time that was available to us. Next week is the last midterm and and I hope to improve my mark for that.

     Only four more weeks of classes left and I hope to make the best of it. The work is piling up between all my classes so time management is key. First things first, I'll do this week's lab and then start reviewing for the midterm. 

     All the best to those in the same boat as me. Hard work pays off. 

     Cheers

Wednesday 25 February 2015

WEEK 7: Debrief and Object-Oriented Programming (OOP)



     Success!

     Even a small challenge to overcome is a big step for a beginner programmer like me. I practiced recursion over the break and I finally got the hang of it! It may have taken many, many trials but I can say with some confidence that I understand recursion to some extent now. This week we are going to add on to what we already know using Binary Trees and practice recursion a tad bit more. It always feels like I've fallen behind when I don't finish my lab but I'm making an effort to completing it before the next lab.

     Now on to this week's topic: OOP

     I chose to write about OOP instead of recursion because I want to take this opportunity to step back and analyze for myself exactly what it is about OOP that I know and also to review the aspects of it I didn't fully understand weeks ago (when doing the first assignment). What is an object? What does it mean to be object oriented? These were the first questions I asked on the first day of classes. Here's what I know now:

     In python, all values are individual objects held a specific memory address that stores information and behavior (type of value and operations for it) of that object. So when we call an object we are calling onto the content (information/value) that it's memory address holds (unless directed otherwise).

    Within this type of programming we can also create a new class of objects. By creating a new class we can create any type of objects that operate in the way we design it to (with it's own functions, methods and restrictions). Here's an example of how a class is created:

    class ClassName:

           """This creates a new class. Your description of the class goes here."""

           def __init__(self):
                 """ (ClassName, type) -> NoneType
                 This method initializes ClassName with it's required parameters.
                 """
                 # initialize any parameters here.

           def specific_class_function(self):
                 """ (ClassName) -> Value
                  This method uses the argument to return something.
                  """
                  # implement function here based on intended return value and parameters.

use __str__ to create a string method representative of ClassName

use __repr__ to create an official string method representative of ClassName

use  __eq__ to create a method that compares two ClassName objects to see if they are equivalent.

Subclasses are child class of the parent class it takes as it's argument. A subclass inherits everything from the parent class and can also override the functions defined in the parent class.

    class SubclassName(ClassName):

           """This creates a subclass of ClassName. It inherits everything from ClassName."""

           def __init__(self):
                 """ (ClassName) -> NoneType
                  This method initializes SubclassName with it's required parameters.
                  """

Creating new objects can be simple or complicated as you want it to be and this is what makes OOP subjective and useful. The more we learn about OOP the more options we have at our disposal.

Cheers

(If there is any conceptual errors please let me know!)

Friday 13 February 2015

WEEK 6 ~ Trees and Recursive Functions

     I'm not all too sure what I find more difficult: writing a recursive function or understanding the trees well enough to write the correct recursive function.

     The latest lab exercise on trees seemed simple at first but got pretty difficult the more we worked at it. My partner and I could not pass all the doctests no matter what we tried. Some code will pass more tests then the others but it was hard to tell if we were on the right track or if it was just worked under specific circumstances. It started to get frustrating which only made it harder. This weekend I'm going to try to finish up the lab exercise and ask for some hints from peers along the way.

     The new assignment requires us to implement recursion so I'm definitely going to spend some time during this reading week to practice recursion and do some of the extra exercises from the previous labs. As soon as I get through that I'm going to start on the assignment so I have enough time to fix the bugs I'll have in this assignment.

    Cheers