Sunday, February 9, 2014

Recursions and Namespaces

     This weeks focus has been on tracing recursions and namespaces. The lab was mainly on recursions, and we traced several different examples. It wasn't too difficult to trace, if you picture each call of the function as a branch and the output as the leaves. The more calls, the more branches that grow, the more leaves. We also look at namespaces and the scope in which a names and variables exists. I think the corresponding names sort of sums them up. Global, non-local and local, all give an idea of where the variable will exist. I found this useful in one case in assignment 1. Where I wanted something to be done only once, in a recursive function. So I created a global Boolean variable which I used for a condition, then changed it afterwards. Since, it was not in the scope of the function, it wouldn't not be changed back and forth from True to False, but rather start as True outside of the function, and only change to False within the function. At least that's how I view it.

Saturday, February 1, 2014

Introduction to Recursion and Exceptions

     This week, and the last, the main focus in class and the labs have been on recursion and exceptions. Both of which are something that I have not done in high school, so I've finally met something new. The one line recursions are a bit confusing to try and dissect. I'd prefer if it was separated into more lines, but It may just be a lack of experience. The recursion involving the writing turtle was very neat, and not at all hard to follow. Recursions are basically a looping function, with a base case to finally stop it. Exceptions are even easier (so far). In our lab we wrote our own tests for a class and it involved an exception. The lab was a bit challenging, but was very helpful in understanding the material. It also helped with exercise 2 which involved creating a function and then a tester for it.

Monday, January 27, 2014

Object Oriented Programming

     I find Object Oriented Programming a very efficient way of programming. It is a very 'clean' way of storing your work and is easily read by other coders. That is of course, one of the most important things a programmer needs to be able to do. OOP is just a better way of doing it. The first 2 weeks in 148 have been somewhat confusing to me, but I'm starting to get the hang of it. I like the idea of not recreating tools that already exist, it's an indication that we're moving on to bigger and better things and not just finding x and y. The main issues that I have been facing are mainly with syntax and form. Although, this can be easily solved by just doing more examples and work in general until it sticks in your head.