Saturday, 28 February 2015

Object Oriented Summary for Week 7

Hello! I would like my previous post, named "Object Oriented Programming Summary" to be considered for evaluation for week 7.

Sunday, 15 February 2015

Object Oriented Programming Summary


Hello everybody! How are you? Midterms and assignments are over (for now!) and reading week, which I think has been long overdue,  has just started. This week, I am not going to introduce anything new but rather, summarize the concepts we have been exposed to in the past 6 weeks!

Firstly, what is object-oriented programming? Object-oriented programming is the process of organizing data into objects and classes. Objects are anything that can store data ,and on which methods can be called. Methods are something that we can do on an object. Methods are exactly like functions except that they are defined inside classes. In my head, I like to visualize the whole process like the following:




Therefore, in some ways, object-oriented programming gives you the ability to organize a huge amount of data and call functions and methods on that data. In Python, the first method that we call is the __init__ method. It initializes every instance of the class. In other words, if we call an instance of the class, the initial values of the instance are the ones set up in the initializer. The way I like to visualize this is as the following:

         Let us say we are playing a couple of board games such as Monopoly and Snake and Ladders.   The initial state of the game such as how much money you are given or not, depends on the game. It is different for Monopoly, Snakes and Ladders etc. Thus, if I decide to play Monopoly(I call an instance of the game), the initial state of the game Monopoly would be called and that would be defined by the parameters in the initializer of Monopoly. On the other hand, if I decide to play Snakes and Ladders, the the initial state of the game Snakes and Ladders would be called and that would be defined by the parameters in the initializer of Snakes and Ladders.

The first parameter in many methods is the parameter "self". From what I have understood, all this parameter does is that it tells the method to work on the instance or data defined in that class. 

Subclasses can be defined inside classes and they not only have the ability to inherit the methods defined in the parent classes but, to also override them. Therefore, we can define some general methods in the parent class and then either use or override them in the children classes.

Secondly, recursion is the ability to define something in terms of itself so that a huge problem can be broken down into smaller subproblems and the solution to the subproblems can be used to solve the bigger problem.

Lastly, Trees ADT are a type of Abstract Data Type in which, data is organized into nodes. The data is organized hierarchically, with the top most being the root and each root branching off into nodes and leaves. I have not fully understood Trees ADT, however,I hope to get the concept cleared in the labs and also by going to the office hours. I have realized that these two things have been really helpful in helping me understand a concept in the past.

To conclude, object-oriented programming(OOP) is a way of organizing data into objects and defining functions and methods on those objects. I hope that my summary of OOP has been accurate and helpful. I have posted a link to another student's blog, which I believe, explains OOP really well. I hope everyone has a good reading break! Stay warm! Nutella helps! http://ak148slogaddress.blogspot.fr/

Sunday, 8 February 2015

First Term Test Down, A Million Still Left To Go

Hi everybody! How are you? Lots of updates this week! So last Tuesday, we had our first ever CSC148 midterm! It was pretty fair to be honest, but I am keeping my fingers crossed, of course! However, more interestingly, we started tracing recursion last week! I believe that this has been the most interesting concept so far.

To define recursion in the most simplest words possible, it is the process of solving a large problem by calling on smaller versions of itself. In other words, if we have a large expression that we have to solve, we can solve it by expressing it in terms of itself and smaller versions of itself. Last week, we did not learn to write any recursion methods but, only to trace them out! It was really interesting to see how a seemingly difficult task can be broken down into smaller parts and how the solutions to these smaller parts can be extended towards solving the larger task.

Thank you for checking in! Please check out the linked blog for a great summary of recursion! Hope you have a great week!http://zhexinlai.blogspot.ca/

Monday, 2 February 2015

Thoughts About The First Few Weeks

I cannot believe it has already been 4 weeks into the term and into the world of Object-Oriented Programming(OOP). I have learnt so much about Computer Science in these past weeks, it surprises me. I have had no programming background before CSC108, which is the predecessor to CSC148, and so the concepts of classes and objects were really alien to me. Thus, it has been quite a challenge to adjust to this new paradigm, but it has been a really fulfilling one.

Over the past month, we have been introduced to the concepts of basic OOP and Abstract Data Types(ADT). We learnt about designing and implementing classes, inheritance, objects, the concept of self and recursion. Moreover, we also learnt to design classes to run a two-player, strategy game in assignment 1. That and recursion have been my favourite parts of the course so far. Initially, I did struggle and I still do struggle with the concept of self and I am still a bit unsure about the difference between a function and a method but, I am hoping to get over this hurdle by going to the office hours and getting my doubts cleared. 

What I really appreciate about the course is the immense help and support available to students,whether there are the CSC undergraduate help centre sessions, the patient professors or the lab TAs. In my experience, I have really learnt the most during the lab hours where we get a chance to implement the alien concepts and learn from coding. I cannot appreciate enough the help of the lab TAs in guiding me through the concepts.

To conclude, I believe that the last few weeks have really introduced me to a new way of thinking, that has effects beyond the domain of Computer Science. I have already noticed a change in the way I approach my other day to day problems by learning to break down problems into small components and going step by step. Well, that was all for this week! My apologies for being day late, but the Internet in my dorm has been a bit unpredictable over this weekend! I would love to hear about experiences of learning Python and coding and would greatly appreciate any tips! Feel free to leave a comment! I have also attached links to some other blogs written by my fellow CSC148 students, please check them out! Stay warm and brace yourself for the midterms these upcoming weeks! Eeks!!! Have a great week!http://klaracsc148.blogspot.ca/http://klaracsc148.blogspot.ca/