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