Friday, 30 January 2015

Impressions

In the second week, the class learned how to prevent coord from changing after a point has been created. We used the built in function property to intercept all code that assigns to coord and passes that off to _set_coord. It can also prevent coord from being set twice. It does this by using an if statement that checks if coord has already been set. We also learned that putting an underscore in front of an instance variable such as self.data. For example, self._data makes the instance variable not part of the public interface. Another important thing we learned this week was stacks. A stack is an ADT that has pop and push methods. The push method puts an object at the top a stack. The pop method removes and returns the most recent item pushed to the top of the stack. I found this ADT to be fairly interesting and my friend Kevin found it interesting too.

In the third week, inheritance and exceptions. Inheritance in a way, is to add functionality. The child class extends the functionality of the parent. Thus, a vehicle may have fields for passengers and speed, and a subclass car may have the field engine type. Also, a child class can redefine the behavior of the parent class. Code that is common to many classes can be placed in a parent class too. To declare that we are extending a super class we write "class NewClass(OldClass):" We can add methods and attributes to specialize. We also learned how to raise existing exceptions. To do this we write "raise ValueError." When the line is reached a value error shows up and the code stops running.

In the fourth week, the class learned about recursion. It is a function that calls on itself to accomplish a task. For example, the code "if isinstance(L, list): return sum([sum_list(x) for x in L]) else: return L" calls on itself if L is a list. The function adds up all the items in a list, including nested lists.

Sunday, 18 January 2015

First CSC148 Slog

Geeks need to know how to write because they need to be able to express what they know and how they feel about what they’re interested in. It allows geeks to be able to explore their creative side. Writing allows us to create original ideas, express our feelings, express our inner thoughts, and communicate with friends and family. Geeks find personal satisfaction in their ability to communicate clearly and effectively using writing.

Knowledge is gained when a person writes about something. From the writing process the mind of the person will also be improved. The mind will be trained to engage in careful systematic analysis, to form opinions, and conclusions from reasoning. Thus, it is very important for geeks to know how to write.

Writing also develops your analytical and rational thinking skills. Working through your problems with writing encourages you to think things through clearly. Many people tend to panic and react emotionally to their problems, but if you’re used to solving them by processing each component of the problem in writing, you’ll develop a better approach and skill-set.