Thursday 23 January 2014

A look into Object - Oriented Programming (OPP)


Intro

Now before I start talking about this magical topic of objects and about the course CSC148, I would like to warn my readers before hand that my SLOGs might not be your 'cup of tea' or coffee (if you like programming for prolonged hours). Most of what I write will be random stuff might not even be what you were expecting(cough cough TAs). I mean its suppose to be a BSLOG after all. Also I would like to apologize beforehand that my writing skill is very lacking compared to my Youtube or Reddit browsing skills. I hope you at least somewhat have a giggle about my SLOG. I forgot feel free to leave comments about anything related to the blog and I will try my best to respond as soon as I can.

Object - Oriented Programming (OPP)


I want to begin talking about my first few weeks of CSC148. From the first day of lectures you know you're in the right class when almost 99% of the students are wearing glasses(too much internet browsing or maybe hardcore coding). Me being a Koala Bear I was the 1% you could say. The first week jumped right into Object - Oriented Programming (OPP). Now I'm not going to lie to my dedicated readers by saying I read all of the weekly readings yet, but that is not to say that I have zero idea about what OPP means. OPP was new to me but at the same time it wasn't a shocking discovery when it was explained to the class. From what I can recall and somewhat understand is that Python is a object - oriented programming language.

Python an Object - oriented program and Exercise 1  

Objects can be used for many different purposes. Objects can have data or functions. This way objects can be used to interact and even relate to real life applications. A Class is used to make an object. Methods(functions) exist inside the class which can be used to interact objects. This was still unclear to me until homework Exercise 1 where  we had to make two classes Toy and Dog which can interact. I decided to go to 148 Ramp-up session in order to get a better idea of how to implement Class. It did help me get a better understanding of Class but my coding for the homework was still not working as intended. I posted my error on the piazza forum and a fellow student explained to me what was wrong, which turned out to be a very minor mistake. This exercise really helped clarify the idea of how useful implementing a Class is in order to create objects.

Lab 2

In Lab2 my partner and I worked through the lab quickly since I had a pretty good understanding of Abstract data types (ADT). It wasn't until the very last question where we were asked to make the Queue Class more efficient. We tried discussing it over and I explained how since Queue takes items from the front each time every item had to move down a position(index) which explained why Stack Class too less time since it popped the last item. The TA did go over the solution but I was still confused as to why putting an index variable helped. I looked in piazza and there are some post about the solution so hopefully during this weekend I can go over it and try to figure it.

I think that is about it sorry for how boring this SLOG became, mostly due to time. Feel free to leave any comments especially about writing structure I feel the structure was quite poor. I'll try to make SLOG2 more readable and even entertaining so you don't feel like sighing after every sentence you read. I must be going now back to the zoo to rule over my Koala Bear Kingdom farewell !