In my first class in computer programming, we began by learning how to write some very basic programs without the use of classes and objects. When classes were first introduced in the course I had a very difficult time understanding what was going on. There were lots of new terms, instance constructors, and I had a hard time comprehending what was happening when objects, which are instances of classes, where being constructed. It also took a lot of work and time to create classes for the extremely simple objects we were considering in our examples. This completely obscured the motivation for classes in the first place! Instead of making the programs easier to think about, write, and modify, using OOP made everything more complicated. However, after being forced to use it and after beginning to use it to write programs to solve more complex problems, OOP gradually made more sense.
At the beginning of this semester, when relearning the basics of OOP in Python, it all really clicked. Our recent assignment on animating an interactive game of Reve's puzzle as well as an automated solution, which was a rather complicated problem, really required the use of OOP to simplify the programming and helped solidify the concepts involved in writing object-oriented programs and the benefits of OOP. I now realize the brilliance of the programming paradigm and how powerful it is for solving problems. The physical world is made up of objects that have properties and have actions done to/with them and consequently, humans naturally think and speak in terms of objects, their attributes, and their methods. Thus representing and using objects in programs is a very natural way to write programs about almost anything you can think of. In the physical world it is also often the case that many specific objects are closely related to each other and are members of a large class of objects, this class of objects might be closely related to other classes of objects, all of which are more specific examples of a larger class of objects, and so on. Creating classes of objects and using inheritance to create subclasses is naturally modelled in OOP. Finally, mathematical objects and mathematical structures, which are a very important aspect of computing, are also well-suited to OOP.
At the beginning of this semester, when relearning the basics of OOP in Python, it all really clicked. Our recent assignment on animating an interactive game of Reve's puzzle as well as an automated solution, which was a rather complicated problem, really required the use of OOP to simplify the programming and helped solidify the concepts involved in writing object-oriented programs and the benefits of OOP. I now realize the brilliance of the programming paradigm and how powerful it is for solving problems. The physical world is made up of objects that have properties and have actions done to/with them and consequently, humans naturally think and speak in terms of objects, their attributes, and their methods. Thus representing and using objects in programs is a very natural way to write programs about almost anything you can think of. In the physical world it is also often the case that many specific objects are closely related to each other and are members of a large class of objects, this class of objects might be closely related to other classes of objects, all of which are more specific examples of a larger class of objects, and so on. Creating classes of objects and using inheritance to create subclasses is naturally modelled in OOP. Finally, mathematical objects and mathematical structures, which are a very important aspect of computing, are also well-suited to OOP.
To somebody new to OOP, the definition given at the start of this entry might seem so general that it hardly says anything at all about what OOP really is. However, the definition does a good job of capturing the generality of what can be coded in an OOP language, which is one of its main strengths.
No comments:
Post a Comment