Hi, everyone!
In week 3 we all wrote something about object-oriented programming. This week, we went back to the topic of recursive function and the professor showed us two more examples. The first one was to return the max deep of the nested list, which was quite similar to the example that we were required to sum the nested list in the second week. Another example was about turtle recursion.
Frankly speaking, recursion is not an easy topic for me, and it took me some time to go over the examples and reading several times in order to have a better understanding. The nicest thing about recursion is the code is elegant. It also will be a good thinking training. Although it seems recursion basically does nothing, still I think what professor concluded about on recursion was very helpful. Basically, recursion involves a base (in order to stop the recursion)and a recursive formula. That is a good guide for me to write recursion function.
Since recursion should be one of the most important topic in csc148, I believe we will still cover it in the next few weeks. Besides, we are required to write something about recursion in week 7. So I think it is not wise to write too many things about recursion now.
I have started to do the A1, given I will have some midterm tests in the middle of February. I have to admit that it was kind of frustrated at the beginning, since I was not sure what attributes should TOAHModel has and how the information of cheese on which stool would be stored. However, I found something inspiring on Piazza, which helped me a lot with first few steps. By the way, I should thank for the people who is very kind to answer questions on Pizza, which gave me some clues about A1.
2014年1月31日星期五
2014年1月21日星期二
Week 3
In the first few weeks, we should be coping with class method, which is a symbol of object-oriented programming. At the beginning, I was not aware of the benefits brought by it and thought it was troublesome. Now, after some lectures about class, I realize what we have learnt in 108 is not the true application of class. At least, in 148, we are so far told that a class is able to subclass from a superclass, and inherit a majority of its features, which makes it much more convenient for programmers in the real world application.
Also, after reading some material about object-oriented, I know that this sort of programming classify the real world problem by different classes, not by the way we need to program it. The most obvious advantage is that we can save tons of work. Every real world problem must share something common with other problems. So, we don't have to build a brand-new program for every problem, which means we can use the previous code if we solved the analogous problem before.
Clearly, there are still much we should learn about Python, and the class thing is just the beginning. In 108, we have 3 hours lecture a week, but it reduces to 2 hours in 148, which means we are asked to be more diligent after class. However, learning something new is always keeping people excited.
In the first few weeks, we should be coping with class method, which is a symbol of object-oriented programming. At the beginning, I was not aware of the benefits brought by it and thought it was troublesome. Now, after some lectures about class, I realize what we have learnt in 108 is not the true application of class. At least, in 148, we are so far told that a class is able to subclass from a superclass, and inherit a majority of its features, which makes it much more convenient for programmers in the real world application.
Also, after reading some material about object-oriented, I know that this sort of programming classify the real world problem by different classes, not by the way we need to program it. The most obvious advantage is that we can save tons of work. Every real world problem must share something common with other problems. So, we don't have to build a brand-new program for every problem, which means we can use the previous code if we solved the analogous problem before.
Clearly, there are still much we should learn about Python, and the class thing is just the beginning. In 108, we have 3 hours lecture a week, but it reduces to 2 hours in 148, which means we are asked to be more diligent after class. However, learning something new is always keeping people excited.
订阅:
博文 (Atom)