Saturday, 14 February 2015

Week 6 - Summary of Object Oriented Programming Concepts.

This week, I will give a brief summary on Object Oriented Programming. So far in CSC148, everything we have covered has to do with Object Oriented Programming. Object oriented programming is when programmers get to choose what data types are used, which data structures are used, and to apply functions and operations to those data types and data structures. A simple example of this is me creating a list of my grades in the form of numbers (that represent percentages), using a for loop (an operation) to iterate through each element in the list to sum the numerical grades together, storing the sum in a variable, and dividing it by the length of the list to come up with an average. This would return a float representing an average percentage grade. In this example, I got to choose the data structures that I want to work with and the operations I want to perform on the data structures.

Some main concepts of object oriented programming we have learned so far in this course are classes and subclasses. Classes are objects that define a set of attributes that characterize objects of the class. For example we can write a class called GameState, in which we would define a method called state_turn, which would return a string telling the player of any game whose turn it is. This class would contain multiple attributes that perform different operations relating to the play of any game. A subclass is a class that inherits the methods of a parent class, and may contain additional methods relating to something more specific. For example, we may have a subclass called TicTacToe(GameState), where the class GameState is the parent class and the subclass would be TicTacToe. The subclass TicTacToe would inherit all the methods of GameState, which contain methods relating to the play of any general game, and the subclass may contain additional methods that may relate to the game TicTacToe.

At this point in the course, I feel very comfortable with the object oriented programming concepts we have learned in this course. One thing that I can continue doing to improve my performance in the course is by starting to work on the lab exercises ahead of time. This week, I did not perform well on the quiz, but after completing the lab exercises today, I realize how easy the quiz was. Also, I realized that I need more than two hours to go through all the exercises in the lab and to understand in depth how each piece of code performs operations. By starting lab exercises Wednesday night, I will have sufficient time to understand all the material in the lab handout, thereby improving my performance in the quizzes.


No comments:

Post a Comment