As a beginner of studying computer science, such terminology actually scares me when I first read it, because it sounds like a really complicated programming type that would take me a long time to understand it. In course csc148, I have learned a lot about classes, inheritances, and recursions, which give me the first impression of OOP concepts.
Inheritance is a main idea of object-oriented programming. Since in programming, it is very common to use one part of a code in order to develop more complicated and specific functions. Instead of just copy and paste the codes, using the concept of inheritance would be helpful and convinience. It prevents errors that might occur efficiently while modifying the original code.
In implementation of classes, the general class would be the code that we needed for further use. The methods of a general class should be general as well in order to be applyed to more specific occasions. However, many methods in general class can not be used directly to perform a job; they need to be inherited in sub classes so that they can be called. Sub classes are the classes that inherit all the methods in its parent class(the general class) and perform specific functions. For example, in assignment1, the gamestate class is a general class that will work for many specific games; and the subtractsquare is a subclass that covers all the functions its parent class has and actually performs them.
Friday, February 27, 2015
Friday, February 6, 2015
Week 5
In these 2 weeks, I have learned about recursions. The first impression of recursion is not so positive as I am scared by the concept of using the function itself within the implementation of that function, which seems complicated. But as the professor shows us the whole method of how to trace recursion, it becomes more clear and straight forward to me. Recursion is somehow like a loop; it can give us the result of each simplest element within the nested list directly, and then break the nests while using that method directly. Thus, tracing recursions will be easy as long as I understand the body of the function.
However, in week4's lab, there is a part that requires us to write the body of the function based on the examples using recursions. I spend about half of an hour to work that out. Now I understand that writing a recursion function is way more difficult than just tracing it. Hopefully I can find a way to solve this problem in the next lectures.
However, in week4's lab, there is a part that requires us to write the body of the function based on the examples using recursions. I spend about half of an hour to work that out. Now I understand that writing a recursion function is way more difficult than just tracing it. Hopefully I can find a way to solve this problem in the next lectures.
Subscribe to:
Posts (Atom)