Saturday, January 31, 2015

Week #4: Impression of first few weeks

Week #4: Impression of first few weeks


The impression of csc148 is quite different from csc108 I took last semester. In csc108 course we need to take prepare and perform exercises every week. As in csc148, we have no prepare videos to watch, but we have one hour lab per week. I think the way to take lab is quite efficient for us to understand the topic discussed in the lecture. Exercise by ourselves and then talk with TAs will save a lot of time to comprehend what we need to learn.

I have learned two main topics from first three weeks. 


First is ADT (Abstract Data Types), i.e. creating our own type by implementing classes. ADT helps us to specify the intended meaning stored in the data, and the operations it provides in the data. In python, we use classes to specify that kind of data. Attributes and behaviors are the important part of a class. We implement the class by methods of __init__,  __str__,  __repr__ and so on.





Second is how to use general class and sub-classes to deal with different situations in our lives. We may face a lot of situations in our lives which can be classified into one situation. That is the general class we need to implement. A general class may contain the same attributes those different situations will all use, and some methods they use in the same time, too. What I like most is one sentence "raise NotImplementedError" which will be written in a method that we cannot write all situations in a general case, but we need to finish it differently in different sub-classes. Also, in a subclass, we can write less by using what we write in the general case.

In lab1 and lab2, I find it quite difficult to determine what type of attributes we may use to initialize the classes. Just like the Registry, I first thought that how can I represent the email addresses of runners and the categories of different speed runners? Then I find that I need a dictionary for the categories, otherwise I cannot find which part of the runners are fast and which are slow. Also I find that the email addresses of runners are only used to find the single runner and get him/her into his/her category of speed, so I use list to represent it.

Thursday, January 22, 2015

Week #3: Why geeks should write?

Week #3: Why geeks should write?



To see whole semester slogs, go to http://148wuboyangw3.blogspot.ca

It is very common for us to face a dilemma when we are debugging something we have debugged before. Although we have solved it several months or several days, or even hours ago, we may still forget what should we do to fix it. So that is simply why we, computer science learners, should write and record frequently.

Just as a student, a debugging journal, or say debugging log, is not only a way to be efficient when we write code for assignments or labs, but also a way to make our test review much more easier. 





One thing that stroke me so deeply last term was that the difference between the global stack and the local stack when we set new variables.  I found this problem confusing when I did my assignment of 'csc108'. After I solved the problem of why I had not change the variable in my function, I did not write this down. Then at midterm, when I was struggling working with the past tests, I failed in many problems related to when the variables would change. So I turned back to my assignment, and used visualizer to debug my code for another time. Finally, I found the difference between the global stack and the local stack, and learned this lesson.

Hence, debugging journal is a good habit to keep during our computer science learning.

Recommend: http://lhzuigao.blogspot.ca/2015/02/summary-of-object-oriented-programming.html?showComment=1428297533544#c5125539547234044692
Yue has mentioned that we have not enough prepare for the implement of classes exercises, I think that should be notice in the future courses.