2015年3月30日星期一

Looking back at earlier posts (Writing for Week 11)



  For this week, I decided to look back my posts about class and recursion. I have to say, I was too naive at the very first place.


__________________________________Part 1Class_______________________________
  I thought that class was complex and useless, because we could wrote everything and everything could work quite well without class. So why do we bother class? It seems that class made things even more complicated. However I was totally wrong.
  The function of "class" is similar with that of categories. Without it, everyone would feel helpless facing a mass of codes. "Class" help us organize or thoughts logically and make our codes readable. We could imagine classes and subclasses as a tree, for example, some classes might have children which are subclasses, and subclasses could inherit everything from their parent and grow their own leaves that are their own characteristics.
  To be specific, class is the trunk or the main branch, which means class could be generous. This makes "hierarchy" possible. Superclass is the parent/leader of other subclasses, every subclass has its own duty and job. You could see the functions of a superclass, but those functions could be used only in subclass. These are the jobs, or we could say the "sub-jobs" of the class.
  Those clearly defined and separate jobs make things easier for programmers and readers to handle. What's more important, if you want to change something in your code according to your clients' requirements, you do not need to change your whole work since other unrelated variables wouldn't be affected by those changes. Why?  Because you separate each function as an independent unit with the help of subclass.

_______________________________Part 2● Recursion_____________________________
  As for recursion, I agree with most of what I said. I really appreciate that we are taught firstly about tracing recursive functions as a way easing us to learn how recursive functions work. Recursion is not simple for me even now. For the most of the time of learning CSC148, I was struggling with recursion. Nevertheless, the more I think, the more useful and elegant recursion is.
  I thought for loop and while loop are much easier, and I still believe they are easy, however, in my opinion, they are only easy to "figure out" and cannot work complex problems easily and well. For recursion, the most difficult part is working out how this recursive function supposed to work, then writing down correspond codes. And I believe, only through practicing can we handle recursion better.


   Looking back at what I've learnt, I'm surprised. We've learnt so much amazing and elegant things in such a short time, though there're still something I have trouble with. The most important thing is, I feel I'm learning more knowledge about computer science and the way that we're supposed to think while programming also help me in other areas.

没有评论:

发表评论