Sunday 2 February 2014

Week 4

This week more staff on recursion was talked about on class. I found it challenging to start designing a recursive code so I did some practices on my own. The built-in class, turtle was interesting since I like the drawing we did in class. I tried several times at home as well and I actually thinking of print some of the drawing on a T-shirt. Maybe CS students would want to have one!

Tuesday 21 January 2014

Week 3 Object-Oriented Programming

Object - Oriented Programming, different from most of the program we learned, is focusing on the creation of object which contain both data and functionality. We did an example in the first week, which is writing a class called Point. Class Point takes two numbers and treat them as a single object which represents the coordinate of a point. In the class, we use __init__ to initialized the Point, and then, if we want, we could add functions to it, too. For example, we wrote function to calculate the distance from the point to the origin. Note in the Object-Oriented format, when we call the function, we use:
>>>point.distance_from_origin()
instead of:
>>>Point.distance_from_origin(point)

Week 2

This week I learned Abstract Data Type(ADT) which is a set of data. The class focused on list and stack and did an example of designing a stack class. We also discusses the difference between list() and set(). finally, we talked about recursion. I found it a little bit hard to understand because I thought you can never use a function inside the function itself. Apparently, I was wrong.

Week 1

This is the first week of CSC148. I found the materials from CSC108 seems to be less familiar to me after the winter break. A new format of function designing which combines the type contract and the header together is taught in the first week's lectures. What's more, I learned how to write list comprehension which saves much time comparing to writing a for loop in function designing. The first week is not that stressful and I hope the following week would not be hard, too.