Sunday, March 29, 2015

Visiting the Past

I haven't really thought of the past much. However, since i'm done with my last midterm, I'm starting to bring back the past (knowledge) back into the present to prepare for exams.

I don't think I have really changed as a person or changed my perspective. Sadly, I have mainly been focusing on short term academic pursuits and ignoring any big picture thoughts. My plan to go into CS and then later decide what to do hasn't really worked out.

The biggest difference I have seen is my mentality on recursion. When the concept was first introduced, I was just unable to even visualize it without focusing completely on recursion. I will still fall into recognition traps where recursion makes sense when the answer is right in front of me.


Source: http://en.wikipedia.org/wiki/Spot_the_difference
So, what's different? I think it's like a spot the difference game. The picture might look exactly the same minus a couple of obvious details (such as the tree branch at the top and the couple at the left) but there are many other changes "hiding in plain sight". I am certain that I am better at coding recusively because now I have more tools such as knowing how to make drawings to help my understanding. However, there are also subtle changes such as neural pathways which were already created in my prefrontal cortex and all across my brain which I subconsciously use to help me solve recursively. I probably have many other tools that I use which I'm not aware of until it is pointed out.

Comparing myself to others in a class so large is tough so I'm going to use some case studies.
http://questionablecsc146decisions.blogspot.ca/ is a thoughtful blog which I feel like I'm at about the same level of understanding of the course as the author.

Instead of making this way longer than it already is, I'm going to summarize and say that after reading lots of slogs, I'm on the same page with lots of people who have a tough time with recursion.

Friday, March 20, 2015

Week 9: Python Garbage

CSC148 is still going strong thanks to the two professors and the TAs who are still working. I don't ever expect to understand what is fully going on especially since have to allocate lots of my time to school.

This week was light on new material. On Monday, we focused on what was going to be on the test and Wednesday was the test. We did introduce deleting.which still fascinates me.

The Oxford Dictionary defines delete as "remove or obliterate". Yet the most common use of deleting is virtual now where everything is composed with binary. Yet turning a 1 into a 0 isn't deleting at all. In a massive line of binary, the damage would probably be minuscule (although I have no idea, I'm just guessing it would work like DNA and mutations). In the YouTube video "What is NOT Random", they say that information, although seemingly based on order is actually disorder or entropy. Then, to delete information, one would have to obliterate the entropy and wipe the region clean. I don't think we'll ever touch this not only because we're first years (for another 2 weeks) but also because Python is an interpreted language.

This goes back to this class where we mutated Linked Lists lists by creating a new node and leaving the old node without a connection to an object. Prof Heap said that Python had a great municipal government and great garbage collection. I've seen a garbage collection class in Java once but I didn't understand the purpose in my ignorance. I still don't really know what that means yet but I have a feeling that it has to do with .decreasing entropy at the binary level. I guess I have to be grateful that it works and not just take it for granted until they go on strike, stop working and me realizing how screwed I am without them. 

(on another note, in linear algebra, we learned about cofactor expansions also called Laplace expansions and Laplace is mentioned early in the video)

Monday, March 16, 2015

Week 8: Assignment 2

Assignment 2 was really difficult. Although most of the assignment (TippyMove and most of TippyGameState) was straightforward, we had major difficulties with the StrategyMinimax class and the TippyGameState.rough_outcome() method. My group and I simply were unable to properly implement these two problems despite over 20 hours of struggling with these two problems.

For rough_outcome, an ideal version of our helper function would count how many 'X's and 'O's there were in an n x m grid. If there were more 'X's in a grid, then that would increment the "advantage" count for 'X'. Similarly, the "advantage" count for 'O' would increase if there were more 'O's. I still don't know why the code didn't work which is very bad.

I still completely agree with my post about recursion on week 5. I only intellectually understand recursive functions once I have already read the code. However, I am still very far off from intuitively thinking recursively. However, I have made progress from week 5. I noticed seeing recursive functions in MAT137 (Calculus!) with recursive sequences. In linear algebra, the determinant can also be defined recursively which is really neat. I even saw this online.
a_0 + \cfrac{1}{a_1 + \cfrac{1}{a_2 + \cfrac{1}{ \ddots + \cfrac{1}{a_n} }}}


Saturday, February 28, 2015

Week 7: Summary Abstract Data Types and more

I was listening to the podcast Spark on CBC Radio (link below) when the host started to talk to the two authors of the article entitled: "'The Cloud' and Other Dangerous Metaphors" by Tim Hwang and Karen Levy (link below). For some reason, this reminded me of the concepts I was learning in class (CSC148 especially).

I remember how Python is an object oriented programming language with plenty of metaphors such as strings which are sort of like lines of characters, dictionaries which have key (words) and entries and heaps, property, stacks, queues, trees and turtle/plushie orca that Prof Heap brought to class which aren't exactly absolutely representational of what it is referring to.

Summary
Abstract Data Types (ADTs) are great example of concepts where metaphors are used. Firstly, the names of the ADTs we used in class and in labs are all metaphors. I think that because of the metaphors, they didn't seem too abstract to me. The reality of how the first two new ADTs introduced in this class, stacks and queues, were very similar came to me during Lab 3. Both were classes which manipulated lists using list methods to create stack and queue methods. Push, pop and is_empty and similar enqueue, dequeue and is_empty  The fundamental difference between the two is that stacks can be summarized as First In Last Out or FILO while queues are First In First Out. The toughest part was implementing dequeue without changing the indices of the rest of the entries. I'll ask a TA about that after the strike. I found trees very difficult because its methods required lots of recursion. I especially had lots of trouble with recursive functions which returned lists.

 As the course notes states, ADTs are a combination of data and behaviour. This fits in perfectly with the metaphors. For example, queues have data or the people who make up the queue and also the predictable pattern of how the people move.

I believe that it is absolutely essential that metaphors are used and taught in schools and in life because I believe that it is how our brains work. As the article points out, judges (at least in the US) use metaphors to create and change laws. A recent prominent example that the PBS Ideas Youtube Channel discussed (link below) is the case of net neutrality. Is the Internet like a common carrier like trucks and planes, buses, boats, pipelines and telephone lines or is it it's own category of information services to be more influenced by market forces? The answer will be the one which acts a better metaphor. We associate and make connections in order to learn more quickly about our environment and world. 

However I also believe that it is also important to look beyond the metaphor. The authors of the article mentioned that "metaphors are encumbered with assumptions and when people use metaphors, they embed those assumptions in the discussion." I believe that the same is true when learning these concepts as well. For example, understanding trees proved to be very difficult for me because I was always picturing a physical living mostly made of water and carbon and oxygen branching up from the ground. I found it initially difficult to understand trees as I tried to flip them and used other metaphors like pyramids (because of the triangles). The recursive methods were the toughest because when I look at leaves, I don't have to start at the root, travel across the branches to the leaves and back again. Eventually, I did slowly start to understand the picture coming into place. Although metaphors are tremendously useful, they, as the authors of the article mention, carry their own baggage.

CBC Spark
http://www.cbc.ca/radio/spark/274-twitter-fiction-designing-a-grief-app-the-dangers-of-digital-metaphor-and-more-1.2936726/surfing-streams-and-clouds-the-dangers-of-digital-metaphor-1.2937081

PBS Ideas Channel Net Neutrality Video
https://www.youtube.com/watch?v=-ft-bU9tn5c

Article: 'The Cloud' and Other Dangerous Metaphors by Tim Hwang and Karen Levy
http://www.theatlantic.com/technology/archive/2015/01/the-cloud-and-other-dangerous-metaphors/384518/

Week 6: Summary of Object Oriented Programmingl

Everything is an object! (in Python)
From strings to lists to functions to integers and I can go on.
What really made this clear was accessing the information

I remember from CSC108 that there was a heap which contained all of the stored objects. It also had a calls stack which was a list of variables and their memory addresses which point to the heap. This was hidden away in my memory until we started using the special python methods __repr__, __str__ and __eq__. Calling an object without overriding the default __repr__ would return the memory address of the object. This is what reminded me that every single object from every boolean value to every dictionary has its own spot in the heap.

I shared many sentiments that Victor presented in his slog (link below) about objects and their widespread use in this course's thinking. In high school, I managed to get away with using only the main method while programming in Java and I only ever really used other functions if it was required. I had this messy code that I probably wouldn't enjoy reading now. However, after practising applying objects in labs and especially assignments, I am feeling much more confident especially after the lab.

Victor stated that object oriented programming gives programmers an opportunity to be lazy. I would like to add that I believe that OOP can also allow us to be virtuously lazy while reading code as well. One can understand the big picture of a program much more quickly if everything is an object rather than going through every line or in the computer's case: processing every single bit. From my beginner's point of view, I think that reading is much more important than writing because the time taken to proofread by the author and potentially by peers can be much greater. Debugging takes way longer than initially coding.

Victor's Slog
http://victorwucsc148.blogspot.ca/

Wednesday, February 4, 2015

Week 5: Recursion(Recursion)

Sorry if this post is late. I didn't read the instructions properly and assumed that the slogs for this course were the same as in CSC165 where we could rant about anything related to the course.

Recursion seems pretty mind stimulating as in it takes a lot of brain power for me to start to get it.
I understand the process of recursion for simple examples but Lab 4 clearly showed to me that I don't understand it enough to create my own examples and use it myself. I've watched a Youtube video that makes sense but I probably won't understand more complex examples of recursion later in the course or outside of this course just yet.

Here's the video: https://www.youtube.com/watch?v=Mv9NEXX1VHc

Saturday, January 31, 2015

How Assignment 1 was done

I think that the reason why assignment 1 was so difficult for me and my group was because we tried to figure out the entire assignment as one entity. We spent hours trying to conceptualize all of the classes at once which didn't get us far.

Eventually, we gave that up and then we just started writing our entire game into the if __name__ == '__main__' game_view.py. Then, we took this code and pretty much copied and pasted it into sub classes like SubtractSquareState that we knew we needed. Then we declared the parent classes like GameState and added generic methods. We also went to the CS Help Centre and the TA was really good and explained a modular way of programming.

What we did right in this assignment is start fairly early where we gave ourselves time to mess up and be confused. I think that I got into the habit of writing docstrings right when I start writing a function rather than going straight to the code and then back tracking.

For the next assignment, I need to learn how to think and program in modules. My plan is to create method and classes that are black boxes that takes input and gives output. I don't need to remember exactly why something works and instead just how to use it.

I also want to use a real time collaboration program like Google Docs except that doesn't format text so the text can be copy and pasted into Wing and compiled. We had a problem of having more than one copy of the program and had to spend time trying to figure out what didn't work. I tried to create a log that had every small change documented but that just ended up being really long. I still want to try the log but the changes I will record will be more general.