Tuesday, February 3, 2015

impression for the first few weeks

In the last few weeks, we learned a blast about object-oriented programming.We started with object-oriented thinking and basic concepts in ADTs. Then we learned how to implement classes, both supper classes and subclasses. And this week we talked about recursion ---- my favourite topic so far. 

Though most of my friends said there had not been any real challenges till now, I was feeling kind of overwhelmed for the first two weeks. More than once I found myself confused during lectures, which never happened in CSC108 last semester. After class, I had to refer to both instructors' lecture slides to grasp the materials. Then I would read related chapters in course notes. But obviously this made my attendance to lectures meaningless. So I changed my strategy. I chose to read course notes before class no matter how busy I was, then what discussed in lectures finally made sense. I have to admit that preview does matter to me, we had video flips for 108, but for 148 course notes are the only resources for me before classes. At least, I feel much more comfortable during lectures now.

What impressed me most was implementation of generic classes and subclasses. This was our focus for the second and third week, and also it was a major part for assignment 1. As reading my fellow students' slogs, I came across one explaining this topic explicitly, which I would like to recommend.
  
The writer basically mentioned 3 things: 1. the init method for the subclasses  2. NotImplementedError for the generic class  3. different syntax for generic class and subclass. Those were quite good points, and I believe inheritance the most important for this part. Here is something I would like to add based on my working on the assignment and practice in the lab.  

1. When designing your classes, you should be clear about what methods you will have in the generic class. The use of these methods should make sense in every case(subclass). To illustrate, in assignment 1, methods in generic GameState work for every game, not just Subtract Square. So we have a generic game strategy, a generic method to decide who's the next player... But we need to be aware that there is no mention of a specific game in the generic methods.

2. The doctest for generic classes and subclasses. We can find good examples on the course website like shape.py, triangle.py and square.py. And remember to write in subclasses the descriptions of methods inherited from the generic class.


No comments:

Post a Comment