Saturday, February 28, 2015

Week 6: Summary of Object Oriented Programmingl

Everything is an object! (in Python)
From strings to lists to functions to integers and I can go on.
What really made this clear was accessing the information

I remember from CSC108 that there was a heap which contained all of the stored objects. It also had a calls stack which was a list of variables and their memory addresses which point to the heap. This was hidden away in my memory until we started using the special python methods __repr__, __str__ and __eq__. Calling an object without overriding the default __repr__ would return the memory address of the object. This is what reminded me that every single object from every boolean value to every dictionary has its own spot in the heap.

I shared many sentiments that Victor presented in his slog (link below) about objects and their widespread use in this course's thinking. In high school, I managed to get away with using only the main method while programming in Java and I only ever really used other functions if it was required. I had this messy code that I probably wouldn't enjoy reading now. However, after practising applying objects in labs and especially assignments, I am feeling much more confident especially after the lab.

Victor stated that object oriented programming gives programmers an opportunity to be lazy. I would like to add that I believe that OOP can also allow us to be virtuously lazy while reading code as well. One can understand the big picture of a program much more quickly if everything is an object rather than going through every line or in the computer's case: processing every single bit. From my beginner's point of view, I think that reading is much more important than writing because the time taken to proofread by the author and potentially by peers can be much greater. Debugging takes way longer than initially coding.

Victor's Slog
http://victorwucsc148.blogspot.ca/

No comments:

Post a Comment