2013年10月9日星期三

Opinions about Object-Oriented Programming and Recursion

  Object-Oriented Programming is also known as the OOP, it is quite different than the traditional procedural programming that it focus mainly on creating class and each class is combined of data and our defined functions. It allows us by adding attributes and methods of our own interests and can directly call on that object and only be accessed by that object class. There are slightly more works than just defining functions, however it truly keeps the solution neat and clean.
 
    Recursion, "defining something in terms of itself" according to what the online book How To Think Like A Computer Scientist: Learning With Python 3 states. To me, recursion works a little big similar to inheritance, that many things can be created through itself, to be a little bit more clear that is it bares similar process as for loop but usually recursion has a smaller scale. Also, without going through hassle, recursion allows a function to call on itself when a subproblem is encounter thus solving the subproblem. It is convenient and sometimes time efficient, as recursion gives the same answer but in a shorter expression.


Upcoming challenge

  It's been quite a while since school started and I am starting to feel a bit more confident on what I am doing now. The exercise 3 allows me to have a more detail idea of how inheritance works, however, somethings I still have trouble defending which class inherit from which, like which is the parent class. I think the opposite way at the beginning, I thought the class with more attributes should inherit from the class with less attributes which is incorrect. I am stuck for quite a while on the Rectangle class that should be inherited from the Parallelogram class in exercise 3. The reason for that is that I don't know how can i modify the the attributes of Rectangle with the class being inherited from Parallelogram, because Rectangle has one less attribute than Parallelogram, that is the theta of the Rectangle is not given to us. However, as I clearly think it all over again, I remember the characteristics of Rectangle that is it is necessary for a Rectangle to have a 90 degree angle thus I set the Rectangle's attribute in its initializer method with a default mode of (self, base, side, 90) which actually give me the correct output of what I want. Being able to identify the key here in the Rectangle class allows me to solve the mystery of the Square class inheritance problem as well. A1 is an even more challenging task for us, but thanks to our professor that he allows us to work with partners. This is surely something that can benefit us, not by lessening our workload, but allow peers to help each other and solve problem together. However, to me, A1 seems a little bit too hard for students because the logic thinking involved is completed and the tkinter documentation is somewhat confusing. The test upcoming next week will be a real challenge to me and really hope I can manage to do okay on this test and goes on with this course.

2013年10月1日星期二

Followup on programing style

  In this week’s lecture, we went through some class examples and
learned about how to raise exception case. I found raising exception
amazing and came to an understanding of how python raise thoseValueError
or NameError etc.I spent a couple hours working on my exercise2,
but when I finally completed it and submitted it to MarkUs,
something interesting happened.
  Most of the testcases had passed except
for the testcase called “Test for PEP8 compliancI spent some time on trying
to figure out what is PEP8 and realized that PEP8 actually refers to a style checker, thus I know that the style of the way we program matters as well. This
implemented me a new mindset, as I previously thought that only the concept matters and the structure of the algorithm do not.
  Now, I am trying to reinforce the idea of programming style so I can be on the right track and hopefully I can get used to it as soon as possible.

2013年9月23日星期一

Programming format confusion

  As expected, the first few weeks of lecture mostly evolve around class and objects. Some of the details of class are still quite vague to me, but every time when I run into some problems, I look into the rampup slides that was forwarded to us and they surely lessen my burden. 
  I was confused with Danny's programming format at the beginning. He didn't really guide us through the design receipe but I can understand that because sometimes there can be many variation and combinations and it is impossible for professor to go over them one by one with us. The part that got me confused for quite a while is actually the function header he wrote. It is slightly different from the format I learned in csc108. We were told to write a function header on the first line and the docstr and description on the second line. Interestingly, Danny didn't seem to include a docstr in his defined function which I found really weird. 
  However, I later on discovered that Danny actually include his docstr in the function header which I found smart and it truly brings clarity. It seems confusing at the beginning as I thought it is something new but when I actually breaks down the code, I realizes some similar pattern in both format. 
  For further understanding,I read each lecture slides over again to make sure my interpretation is right. Now, I learned to adopt this new kind of programming format. 
  I am excited and do look forward to the next lecture. 

New challenge of CSC148H1F

  This is the first week of school and many of us came to school unprepared, including myself being one of them.I took csc108 last year which fulfill the requirement of csc148. However, I personally don't feel as confident about the material about class and objects and from what I heard, csc148 is challenging because the course flow is almost twice as quick as it was in csc108 and the topics that will be covered in csc148 will mostly be surrounding class and objects.
  I was really nervous during the first lecture but thankfully, our professor Danny actually went through many of the csc108 material with us in class and gave us a list of website access that gives some tutorial about python. Those lists are so useful and I set them as my favourite pages in my laptop.For further preparation, I went through some of the past notes that I took for my csc108 courses and also went through the 70 pages rampup slides that were forwarded to students.
  I hope I can manage to do well in the upcoming classes.