Beginning of CSC148 course, we started to
the class unit that continues from the end of CSC108 course. Firstly, I thought
that class in Python is just another way to write functions in Python. Whereas,
I made a fundamental mistake, which is that class is more efficient than
function, after following three weeks. Class also has more official name,
called Object-oriented programming (OOP). There are mainly existing objects,
attributes and methods. According to my comprehension, objects are the
instances of classes by using methods to associate and the attributes describe
what the objects are. Compared to the function in Python, OOP with simpler code
and space completes the work quickly and uses relatively less time to run the
code. As three weeks gone, some problems concerning OOP appeared during the
process of doing assignments, labs and reviewing the notes. One of the greatest
problems is that I cannot determine when the attributes of instances or of
classes and what is the difference between those. Now maybe I can explain and
fix this problem by self-studying. The attributes of classes are t only for storing
and saving the data that associates to the classes. The attributes of instances
are the individual part. However, there are some links between those two parts.
The attributes of classes can be called by using the instances if the instances
don’t have the same variables’ names as the classes had. If the instances do
have the same attributes’ names of classes, it should be the attributes of the
instances when using the corresponding instances called the attributes. This is
my explanation of this problem, maybe too complex to describe, just saying as
clear as I can. Keep going on for myself!
没有评论:
发表评论