Wednesday 22 January 2014


Csc148 slog entry:

     Although I have no intention of becoming a programmer at this time, I often wonder how I’ve even been able to make it this far. Then I look back and realize that it’s not an easy task either. Computer science is a lot harder than one may think, but if you try hard, then there are cases where you will be rewarded for your effort.
     There are many things we talked about this week that I’ve been struggling to grasp. The first is recursion.  One of the hardest tasks I found with recursion was tracing the code, especially for nested lists. One example asked of my class was to use a method sum_list to sum the integers in a nested list. It was a bit difficult to trace at first because the nested lists can really throw you off. A great way to practice tracing this type of code is to remember that every time you see a list within a list, you say to yourself “sum_list” and you’ll probably remember that because of the recursion the entire nested list gets summed in a separate stack, producing a single int in place of the nested list. It’s sort of the “human version” of recursion, which is basically calling the function on itself, except you have to manually tell yourself that.

     Another tricky thing that I found I had problems with is object oriented programming. In theory it should be easy, but the reality is that not everyone can be a python whiz in a couple of hours (and those of you that can, please share your secret!). When doing object oriented programming, it’s very easy to start getting confused with all the variable names floating around, regardless of how prudent you were in choosing those names. In my lab, I found I had quite a bit of confusion with python built-in method “pop” and class abstract data type’s method “pop”. A good way to not confuse them is to choose variable names that are meaningful of course, but if it becomes tricky, always have the original pseudo-code for a stack you’re crafting (found in the week 2 readings at
http://openbookproject.net/thinkcs/python/english3e/stacks.html , section 25.3) in mind so if you lose track of a method you’re designing or something along those lines, then you can find your way by tracing the stack pseudo-code and paralleling that trace with your current code.

If you need any explanation cleared or would like to share your insight into dealing with these kinds of problems, please feel free to comment. I hope to improve this Slog based on your suggestions and I am happy to receive any feedback you feel would help me to improve, both as a person, a computer scientist and as a blogger. Good luck fellow students!
 

Thus concludes my first entry. If you're a Ren and Stimpy fan, you'll probably also enjoy this little treat (Professor Heap calls it the 'slog' song...) https://www.youtube.com/watch?v=2C7mNr5WMjA