2015年3月1日星期日

week 7 (oriental objects programming)

I have already wrote the summary of oriental objects programming in my week 6 slog. So I choose that slog as my graded slog.

2015年2月16日星期一

Week 6

    Object-oriented programming includes many different parts, I will briefly explain something that I learnt like “class”, “method” “inheritance”. 

    Firstly, I would like to talk about “class”. If we talk about “Class” individually, “Class” is an extensive definition.  What particular “Class” define is what a particular group of items can do. And everything which fit this group can be executed by this “class”. Let’s assume that there is class called “PC”. Then, we can know that “PC” is a specific “object” for this class.   In addition, there are some different methods like “open PC”, “close PC”.  Briefly, this class called “PC” is set to execute every PC. Well, there are many different PC brands like Dell, Asus, and Lenovo. All of these various PC fit the class of “PC”, because they are PCs as we know.
    
    “Inheritance” is another interesting part. Sometimes, we could make a children class for a parent class. Let’s assume that there is a parent class called PC which can execute every PC like I mentioned in the last paragraph. Well, there is a children class called “laptop”. We just use some simple methods of python in order to call parent class in the children class. Now, children class has characteristics of parent class. The class “laptop” also can execute “open PC”, and “close PC”. However, the children class can be more specific than its parent class. For example, we may add one more method like “taking my laptop”. By the way, the method of “taking my laptop” is in the children class, the parent class cannot have or execute this method by itself.
    
    Generally, if children classes are executed, children still include functions of parent class. However, if parent classes are executed, children classes cannot do anything. I also read over one of my classmates’ blog (http://anniesslog.blogspot.ca/). She mentioned “NotImplementError”. This happens when a specific method, which is designed for a children class, appears in a parent class. If a parent class is executed individually, that method will not be executed. That method only can be executed when children class is being executing.

2015年2月8日星期日

week5

I learnt tracing recursion recently. This is one of most interesting function that I’ve ever seen since I began to learn python. Briefly, it is a function that repeat itself inside the function. Perhaps, you still do not have a clear idea. Actually, we can assume that there is a function called “opening doors”.

The purpose of the function is to open a door whenever you see a door. Then, I go to a random hotel. There are many doors on each floor. Next, I see Rm 101 with closed door. Based on the “opening doors” function, I ought to open the door. Well, I see another door of bathroom and I open it again due to the function. Now, there is no more closed doors in the bathroom. So, I go out. And now I see a door of bedroom and I open it like what I did to the bathroom previously. Then, I see a door of balcony, open it. At present, I opened all doors in Rm101. So I go to Rm 102 and do everything over again and again until I open all doors of this hotel.  

Recursion function is like “this opening door function”. It will trace every same element within inputs.


In addition, I read over one of my classmate’s blog called http://sherryxq.blogspot.ca/. On her website, she clearly define some simple recursion function that we learnt during lecture. She also post some photos with notes. I think this helpful for us to understand a real recursion function. Even though someone wrote a list of list of list, appropriate recursion function is able to trace each level of it. 

2015年1月31日星期六

week 4 slog

I have done the first month of studying csc148. I found out something different from what I’ve learnt in csc108. Firstly, I have to say I have no previous knowledge of any programming before I learnt csc108. In last semester, basically all assignment that I had done were based on given def, examples and docstrings. Therefore, those assignment were more understandable. Each functions were only responsible for one step or small part of process. On the contrary, the first assignment of csc148 really made me overwhelmed. In the first assignment, I was told to design a program which was able complete required function. There was no docstrings or any examples. My partners and I have to start from nothing. Therefore, I can see the different requirement of csc148, even though there is no big difference between the ways of teaching in csc108 and 148 I believe. In csc148, I am asked for finishing more program-like projects rather than just one part or single step of function. Now, I need to combine different steps into a whole program that can really do something, not just collect sums or make a list or dictionary. So if I want to design a complete program, I have to think how single function can connect to each other and how important parameters are applied at various positions. That requires more critical thinking I believe. 

2015年1月24日星期六

Why geeks should write

Writing is one of most important ways of communication. Usually, we can talk to each other face to face. However, what if you want to talk to millions of people? Magazines, newspaper, weekly, those are perfect ways to tell the whole world what you have done. For geeks, whenever you find out a secret or new thing about computer, probably you would like to share it to others as more as you can. This is how geeks improve and develop the virtual world. Apparently, talking is not able to explain complicated computer theories. Well, writing helps you record and make people see your works anytime they want. By the way of writing, Predecessors can print all knowledge on paper. Students are going to know your ideas and create more things. This is how we learn new knowledge and how society develops.