2015年1月29日星期四

Week 4

Recursion - Such a mysterious and powerful tool !
  • Recursion
  At the first sight of the word 'Recursion', I thought it is the same as 'Loop' or 'Iteration'. But, actually, it owns the very different principle. 

  Before I learn recursion, I might do a math of computing 1 + 2 + 3 + .. .+ 100 with a loop like:
sum = 0
for i in range(101):
  sum += i
 After I learn recursion , I will do like this:
def gs(x):
 if x != 0:
   return x + gs(x-1)
 else:
   return 0
  To my mind, I think the essence of recursion is to allocate a task into several small pieces with the same operation method. Because, the best thing that a computer to do is to repeat a thing for thousands of times.
  Hence, recursion just takes this advantage to solve some very heavy but actually simple and repeated work.However, the most important and difficult thing is to analyse a task and could think of that it could be allocate into many small simple tasks.And then, write down their relationships by codes, which is such a challenge and needs many tons of practice.
  In a word, more you practice, more you learn.

2015年1月22日星期四

Week 3

Hello CSC148!
  • Slog
  • Inheritance
I thought I have said good buy to Slog after CSC165. But...


To be honest, I do not like writing in any form. Undeniably, writing things down really do a better job for us to reorganize our mind and help us to clarify out thoughts to others more explicitly, which makes me to take it serious and do a great job of the last session. Apart from this, team work is very important for programming a very large project, which requires enough communication for programmers to change there thoughts and make adjust to each other. Hence, I will keep going on without any complains.

The first interesting concept of programming is Inheritance. Because I learned some languages before by myself, hence, the concept rings a bell to me. 

literally, inheritance just indicates a relationship between two classes. class B(A) means that subclass B owns all attributions and methods of superclass A. Moreover, B could choose to add more attributions and methods or even override(overwrite) the method of A for some peculiarities of B, which allows us to make the subclass more complex by inheriting the base of the superclass. 

Besides, we could use one superclass to create many other subclass which shares some similar features but more special peculiarities.

More you practice and more you will learn.