Monday, 14 October 2013

Entry 1: Object Oriented Programming - The Metaphor

  Object oriented programming(OOP): the name says it all. Essentially, it's a style of coding that treats data as objects. At first, it's relevance seemed trivial; and when my professor went over a paragraph getting us to pick verbs and adjectives to construct a specific class of object, it seemed comical (surely, grammar was superfluous in the world of coding). A little research, however, was enough to make me see its practicality and appreciate the metaphor-who knew computer scientists could be so poetic?

   To understand the metaphor, I first looked at individual objects- each contained a set of attributes and methods- the respective analogues to the adjectives and verbs that my professor was talking about. If I want to make a class called Gear, for instance, I have to fill it with attributes: number of cogs, diameter- to name a few- and methods: turn right, turn left. I can make varying instances of this Gear class and cause them to interact with each other, as long as I write the correct code, and hypothetically construct my own clock. This way, though my clock is abstract, in that I can't see it and it's strictly represented by data, I understand it in the same way that I do a physical clock: it is a series of interacting objects whose collective collaboration yields a final output.

  Thus, when considering complex programs, OPP is very useful in that it allows the user to break apart the code into its constituents- the objects from which its built up- and understand the code dynamically, according to sub-functions, rather than line per line. If a program utilizes various user defined objects, the integrity of the entire program's functionality is not jeopardized by examining one class at a time, while treating the others as 'intelligent' black boxes, thereby facilitating the process of debugging.
   
   In terms of inter-programmer coding, OPP is useful in that the underlying code behind user defined classes may be distinct without altering the surface characteristics of the final program's output. Thus, programs (and  abstract data types, whose semantics must remain the same but implementation differs) can be shared, and effectively modified by different users.

1 comment:

  1. Laura, here is something to think about: What are the disadvantages of OOP? Can you think of problems that don't want use OOP paradigm in implementing them?

    ReplyDelete