My Thoughts on Object Oriented Programming
I like object oriented programming. It just makes sense. It is a sensible, layered process,
where even a person who isn’t adept at programming can follow the process. The
organization is also simple to understand. Object oriented programming almost
always follows the same formula, that way there is no variation when one is
approaching a problem. Simply start with a class, followed by an __init__
method. Then adapt your code via multiple methods, and possibly even subclasses
with their own methods. The process is foolproof!
In my opinion, the key to object oriented programming is
clear and logical names for classes and their methods. If the methods have a
logical name, then they are clear for the end user to follow through with their
application of said code. For example, analyzing the Stack class from the
lectures, the usage of the terms push, pop,
and is_empty, the goal of the methods
are clear from just their names. Imagine the methods were named numerically (ie.
method1, method2, etc…). A new client
of the code would be so alienated and flustered that your code would be
useless. Because the client is essentially the user of the code, transparency
within the methods of your class are the end goal, and the most important part.
No comments:
Post a Comment