Object-oriented programming focuses on the creation and
programming of objects. These objects, such as Dog, can be created with the
class system, where you can assign to it different attributes inside the
__init__ method, like name, type, etc. Within these classes, methods can be
implemented to manipulate its attributes. These methods are typical functions,
but they are accessible by typing object.method(x) inside the shell. For
example, if we have an object Phone, we can write a method Call(self, person) to
call a person, producing a string of a conversation. To further understand the
meaning of object-oriented programming, a reading from the first week provided
a straightforward description: "In procedural programming the focus is on
writing functions or procedures which operate on data. In
object-oriented programming the focus is on the creation of objects
which contain both data and functionality together." Exercise One tied in
perfectly with the quote above. The exercise gave us the task to write a Dog
object and a Toy object, and showed how their unique methods allow these
objects to interact. I prefer object-oriented programming because it feels like
I'm actually manipulating something substantial or valuable. While, in
procedural programming, it felt like I was inputting arbitrary values into
functions, which were often confusing and scattered all over a python file, to
see what they would produce. Now that I know the basics of Python programming,
I think I'm ready to tackle bigger, more rewarding tasks.
*Notable readings: Object-oriented Python
*Notable readings: Object-oriented Python