Sunday, 15 March 2015
Sunday, 8 March 2015
Monday, 2 March 2015
Object Oriented Programming summary!
(for evaluator,
I chose my previous slog entry as worth of evaluation, therefor I will copy the contents from the entry into this one.)
I believe that object oriented programming will be one of the more useful tools in my tool belt moving forward in my computer science career. One aspect of object oriented programming which I Found to be immensely useful was the concept of inheritance. In order for me to fully understand the mechanisms behind inheritance I looked at many examples classes and sub-classes in a python visualizer and traced the intricacies of inheritance. one such example is pictured below and was taken from the lecture slides.
In this example the output will be:
a.f(1): 1
b.f(1): 2
At first it was hard to understand why the output was as such but when looking through the visualizer I realized that a call to print b.f(1) would first go to the method 'f' in the class 'A' which would then call for method 'g' in the subclass. From this is became easier to understand that python will first look for the method in the subclass before it starts looking for the method in the superclass. Once this confusion was cleared up it became quite simple to trace programs which make use of inheritance.
Another aspect of object oriented programming I found to be important was its ability to easily make use of abstract data types. Integrating object oriented programming with ADTs is extremely flexible, case in point being the assignments we are completing within CSC148. In these assignments we are able to make a wide range of games with even limited tools. In assignment 2 we are expected to create a game of Tippy, which is a tic-tac-toe variant, and in addition to creating the game we must also employ a strong strategy for the computer's choice of move. The flexibility of classes make it such that setting up the game board and integrating strategies can all be done inside the classes! Classes can hold many different types of objects making them a very powerful tool when trying to tackle problems which require a wide range of tools.
going forward, under the umbrella of object oriented programming, there will be a more in depth analysis on recursion and its various applications. Integrating the recursive processes with my current knowledge of object oriented programming I hope will lead to many fun and fruitful results.
I chose my previous slog entry as worth of evaluation, therefor I will copy the contents from the entry into this one.)
I believe that object oriented programming will be one of the more useful tools in my tool belt moving forward in my computer science career. One aspect of object oriented programming which I Found to be immensely useful was the concept of inheritance. In order for me to fully understand the mechanisms behind inheritance I looked at many examples classes and sub-classes in a python visualizer and traced the intricacies of inheritance. one such example is pictured below and was taken from the lecture slides.
In this example the output will be:
a.f(1): 1
b.f(1): 2
At first it was hard to understand why the output was as such but when looking through the visualizer I realized that a call to print b.f(1) would first go to the method 'f' in the class 'A' which would then call for method 'g' in the subclass. From this is became easier to understand that python will first look for the method in the subclass before it starts looking for the method in the superclass. Once this confusion was cleared up it became quite simple to trace programs which make use of inheritance.
Another aspect of object oriented programming I found to be important was its ability to easily make use of abstract data types. Integrating object oriented programming with ADTs is extremely flexible, case in point being the assignments we are completing within CSC148. In these assignments we are able to make a wide range of games with even limited tools. In assignment 2 we are expected to create a game of Tippy, which is a tic-tac-toe variant, and in addition to creating the game we must also employ a strong strategy for the computer's choice of move. The flexibility of classes make it such that setting up the game board and integrating strategies can all be done inside the classes! Classes can hold many different types of objects making them a very powerful tool when trying to tackle problems which require a wide range of tools.
going forward, under the umbrella of object oriented programming, there will be a more in depth analysis on recursion and its various applications. Integrating the recursive processes with my current knowledge of object oriented programming I hope will lead to many fun and fruitful results.
Subscribe to:
Comments (Atom)
