Monday, 16 February 2015
Object-Oriented Programming
To start off on this topic, I actually had to do a little research on the definition since I wasn't exactly sure what to write about. Doing a quick search on wiki, I found that object-oriented programming (OOP), is based on data structures, and procedural code, which is our methods and functions. So how OOP works in the grand scheme of it all is the objects are basically pieces of gears that work together. For example, in assignment 1, we had the parent classes which had methods that provided the general structure for different kinds of games and the subclass which inherited the general methods from the parent class and also included the methods for Subtract Square and its AI. And together, they produced a fully functional Subtract Square game. A thing to note is that since the methods in the parent classes aren't specific to any games, it usually passes an exception. This exception allows the parent class to have the general structure without having any procedural code, since you need to have code according to a specific game, which is located in the subclass. Some functions that don't belong to a class are called module-level functions. These type of functions operate independently from any other class but may use functions from other classes. Usually these are helper functions that make our lives easier by implementing these helper functions instead of having to code the same lines over and over again. That's basically what OOP is and I hope to learn about the other OOP languages such as C++ and Java in the future.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment