For the past few weeks, we learned about designing class,subclasses, and recursion.
Since I have knowledge about some of basic parts in class from CSC108, I was able to understand the methods such as __init__, __str__, and __eq__. However the method called, __repr__ was confused a little bit at the first look(I could not find the difference between str method and repr method.), although now I partly got the difference between them. (Method __str__ returns a human-friendly string describing the object while __repr__ returns a string that can construct an object with the same value. right?)
The hardest thing on "class" was figuring out what methods I should write, and choosing the appropriate name for them. But this becomes quite better now by doing practices through the assignment1 and put and see the questions in piazza.
So here is the key points:
class name -> the most important subject
method name -> the important verbs(that explain what I am supposed to do)
Also looking both instructors' lecture slides helps me a lot, since two professors' styles of explanation are different in some parts(for some point, Danny Heap's explanation is more understandable while for some other point, Diana's slides are more understandable), I think reviewing both professors' slides would be helpful for understanding.
No comments:
Post a Comment