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.

No comments:

Post a Comment