Wednesday, January 22, 2014

Week 3: Object Oriented Programming

      Walking into class not knowing what to expect on Day 1, I prepared myself to embrace the barrage of new information I was about to face. I clearly did not pay enough attention in CSC108, because I had no idea what object-oriented programming (OOP) was.
      Now it's Week 3 and I understand that OOP is a way of programming using mainly objects/ideas represented as classes. The best analogy for a class and its attributes is a phone and its functions, the phone being a class and its functions being the attributes. OOP gives computer scientists a way to define and organize what they want in a blueprint while utilizing the built-ins of programming languages. This "blueprint" is helpful because it allows computer scientists to modify data structures more easily to accommodate the rapid progression of technology. Compared to procedural programming, OOP is advantageous because it allows us to manipulate data and its behavior at the same time.
      We also got a glimpse of recursion in one of the lessons, which is something new to me. Recursion is generally when a function is called within itself. For example, in the sum_list example in class, the sum of a list was the sum of all the nested lists; sum_list was called on the smaller lists before being called on the list as a whole. After writing so many horrendous-looking for-loops in CSC108, I was thankful for this new information.
      I did not finish the first lab assignment, but I still found it helpful because seeing someone do it and having to type the code out with my own fingers are two completely different lessons. I did not finish the efficiency section of the second lab either, although I am confident I understood the idea behind it. If I did not have to pop anything from the stack/queue, I could just move the head of the list to the next index for each iteration. That way, every object does not have to be shifted over one index. I don't feel entirely confident in my OOP abilities, but I am excited to see what sorts of problems I can solve just by writing some code.

No comments:

Post a Comment