OOP
All kinds of programming languages
including Java, C++, C, and python, which we are currently studying are all
object-oriented programming languages. Almost all the languages that are
popular now are OOP, which has a great advantage based on the way how it
organize the models of the objects. Basically, OOP is organized by encapsulation,
inheritance, and polymorphism.
Since OOP is ‘object-orientated’, it can
break the abstract and complicated parts into smaller pieces of objects to
break down issues.
We have not really learned about ‘encapsulation’
and ‘polymorphism’ yet, but basically, if my interpretation is right,
‘encapsulation’ is more like a box that prevent the access of codes and data by
the other data. This property helps to share the codes both publicly and
privately, which means showing people
codes that the programmer want them to see and hiding the private ones from
people to prevent them from modifying them. Apart from that, ‘polymorphism’ refers
to using the same name of the object while doing different things. We have not
learned this yet and I am not sure about this part, maybe my interpretation is
wrong, but it is my guess.
For ‘inheritance’, we just learned it
yesterday, which is to make subclasses of the basic classes. Based on the
example in class, the subset of exceptions have special-exception and
extreme-exception, which is the subset of class special-exception. That is to
say, exception has all the properties extreme-exception and special-exception
has. Thus, exception can basically include everything, yet special-exceptions
might only contain the strings, and extreme-exception only contains ints in
strings. In other words, each subclasses of classes has their own unique properties,
and the basic properties from the original class was inherited to all the
subclasses.
In conclusion, we have only touched the
basic stuff of OOP now, which means that we will be able to have more ideas
about ‘encapsulation’ and ‘polymorphism’ in the future. The comprehension of
inheritance might not be appropriate as well, but we are learning it now, so
more examples in classes and exercises might help us more on interpreting it.
No comments:
Post a Comment