Sunday, February 23, 2014

Week 6 - Last Week Before Reading Week

I have focused mainly on assignment 1 this week and I am very glad to see things pulling together. The weather is also a lot better, and I am very excited about it.
This week we talked about trees in class, the names of different parts of trees, and simple definitions on the parts. For example, each non-root node has exactly one parent.We also went over the code for preorder traversal, in-order traversal, and post-order traversal, and compared the differences between the three different ways to go over the root.
I think I will definitely need some time to understand the parts and the names of the trees, and considering how it is included in the mid-term test.

Sunday, February 9, 2014

Week 5

    The snowstorm was terrible this week, yet I managed to go to both of the lectures and I am very proud of myself for doing so. In both of the lectures, Professor Heap focused on leading us through the first assignment.
    On Monday, he led us through the process of moving cheese and explained basic rules for moving cheeses around. During the lecture, he gave us an example of move_cheeses which prints the intermediate steps of moving a pile of cheeses from a place to another. I think the function is very helpful and gave me basic information about the general rules of moving cheeses. If there are more than 1 cheese, the function uses recursive functions to move cheeses around. I don't think understanding recursive functions is too hard for me. It is not easy, of course, but I can still figure it out after some work.
    However, writing recursive functions in the lab was a lot more difficult than I expected. In the first two problems, we were asked to trace codes for greatest common denominator and binary representation. Tracing the codes was fairly simple, and the lab handout helped to specify thing a lot as well. However, I found it a lot harder when it came to me writing the codes myself. At first, I was kind of lost when my TA told me that I am not allowed to use a for loop. But later it got clearer and I was very happy that I could figure things out myself.

Monday, February 3, 2014

Week4

In week 4 lectures, we looked at assignment 1 together. And I haven't read through the assignment handout yet, which I will read really soon. During the lecture, we talked about the nesting depth of list with "return (1 + max([nested_depth(x) for x in L] + 0) if is instance(L, list) else 0). This is probably one of my first recursive functions I have ever seen. It is very interesting to see how the recursive function can combine if and else into one or two lines of functions. It first checks whether the given variable is a list or not, and then decide what to do with the function call.We also saw tree_burst.py. The function kept calling itself using recursive codes, and generated literally tree burst which was pretty impressive.

I have found the lab and exercise 2 to be fairly easy to follow and did not take that much time for me to figure things out.

Monday, January 20, 2014

Object-Orientated Programming

    In the second week of class, we learnt more about object-orientated programming, and how Python is also a object-orientated language. It is very interesting to see what we are learning now can trace all the way back to 1960s. The difference between object-orientated programming and other programming paradigm is that it focuses on the creation of objects.

    The idea of the object-orientated programming is kind of vague, and thus a bit hard for me to follow. The examples Dr.Heap went through in class were clear, but can definitely be improved. For a while in class, I feel like I don't understand the point of what he was talking about. But the lab last week helped a lot. It made me think a lot, and sort of understood what the prof was talking about in class. However, I still don't feel very confident about the material covered last week, and I looked at the slides from class, but it did not help as much as I expected.     I think the amount of people in the 10 am lecture also bothered me a lot. I was registered in the lecture, and whenever I got to the lecture hall right on time, there were never enough seats for everyone in class. There were people from other sections coming to the lectures, and it was very disturbing. I had to stand at the very back and it was really hard to focus. I hope that people can just go to the sections that they signed up for so that things can be easier for everyone.
    

    The exercise was quite easy for me. I feel like the materials covered in the exercise are more or less from CSC108, and it was more of a review than understanding the materials about object-orientated programming.
     

    Object Oriented Programming is a programing style that represents data and theoretical concepts as "objects" and the corresponding operations on the "objects" as "methods". During the initialization of an "object", "attributes" will be attached to the object defined. In computer science, object oriented programming can greatly simplify practical tasks by attaching a finite subset of functions to a specific type. This way, computer scientists can freely choose among different existing types and have the flexibility of creating classes of their own based on the demands of their tasks. With object oriented programming, the implementation of Abstract Data types are also greatly simplified since it is only the analogue of creating a class. Object Orientated Programming can also help programmer to understand GUI in a more intuitive way. For instance, the creation of a space in tkinter is simply the class Canvas. The appearance of a rectangle on the screen is simply the implementation of the create_rectangle method to the Canvas class.