Friday, February 20, 2015

Object Oriented Programming

Why is Object-Oriented Programming Useful? 

This blog post is those new to programming and have probably heard about "object-oriented programming", "OOP", "classes", "inheritance/encapsulation/polymorphism", and other computer science terms but still don't get what exactly OOP is used for. In this post I'll explain why OOP is used and how it makes coding easier. This post uses Python 3 code, but the concepts apply to any programming language.
There are two key non-OOP concepts to understand right off the bat:
  1. Duplicate code is a Bad Thing.
  2. Code will always be changed.
Aside from small "throw-away" programs that are written for some single task and only run once, you'll almost always need to update your code to either fix bugs or add new features. A large part of writing good software is writing software that is readable and easy to change.
If you have copy/pasted code in your program, changing it requires making the same change to multiple places in your program. This is problematic. If you miss applying the change to some places, you'll fail to fix the bug everywhere or implement the new feature inconsistently. Duplicate code is a Bad Thing. Having duplicate code in your program is setting yourself up for bugs and headache.
Functions let you get rid of duplicate code. You write the code in a function once, and just call the function everywhere your program needs that code run. Updating the function's code updates it everywhere the function is called automatically. Just as functions makes updating code easier, using object-oriented programming techniques also organizes your code to make changes easier.And code will always be changed.
Summary
I hate programming tutorials for beginners that start with object-oriented programming. OOP is a very abstract concept. Until have some experience and are writing large programs, example like Assignment 1. After A1 ,I have no problem with OOP. I am enjoy it now. 

Monday, February 9, 2015

week 5 slog

 I initially found recursion to be a rather difficult concept for me. This is especially true when I first learned it. I initially had difficult with it because I didn’t know what the is instance function does. I also didn’t get the recursion question right on the quiz, which everyone else found to be easy. That was especially discouraging. but later I practiced a lot of recursion questions, went over the handout in class for many times, and became much better at it.

Recursion becomes easy once you get a hand of it. It also becomes quiet meaningful and useful. After I learned recursion, I found it to be a great way to solve many of my previous coding difficulties. Their applications are so vast and so useful.

We had a test this week. I didn’t make it there because I was sick. However, I heard the test was quiet hard so I am happy that I dodged it!