Thursday, 23 January 2014

Object-Oriented Programming (OOP)

Object-Oriented Programming (OOP)


Whist learning about python in CSC108, Paul just brushed the surface of Python, but I feel the skills we learnt are very useful. In one of the readings we were given, it talked about using a tuple or a class to create the compound object. Which do you prefer between tuples and classes? What are the reasons that you prefer tuples over classes, or classes over tuples? I personally do not like tuples because they are immutable so when the idea of creating a class was pushed forward, I was all for it. It is easier to create the method for the class and I feel they are more specific for the object you created. It also provides a sense of organization if you are writing a lot of methods. I also like the fact that we can return instances as return values. Working in pairs in the lab was good revision on writing classes because I had actually forgotten a little bit of it. My partner was still familiar with the basics (thank God), so where I had problems with my functions, he was more than willing to help.

When defining the methods, we now write the type contract differently. I think it is a more effective and clear way of writing it, so as a pythonista, this was preferable. I would find it interesting to hear how others feel about this. Were you taught other ways of writing type contracts? Do you prefer the way we were taught in CSC108 or how we were taught in CSC165?  I do not understand why we were only taught about this now. It would be easier to simply teach us these things from the get go.

Last week, we had a mini exercise to find the nouns and its important attributes. It was fun looking at this paragraph and thinking about possible classes and possible methods, being able to apply the knowledge in Python to real life situations. This helped me realise all the practical uses of Python and all the other programming languages we will learn. This Monday, we learnt about exceptions and I had no idea what was going on. Did anyone else feel this way or was I alone. Hopefully, before the end of the week, I’ll re-read the material and see what I can pick up. Also asking my TA and my lab partner may be some help. The idea of subclasses and superclasses was also very thought provoking. It made me look through the previous functions and assignments I had written about and how I could have applied all these new things I have learnt. That’s something all you Pythonista’s could think about.


Have an awesome week.

No comments:

Post a Comment