Monday, 30 March 2015

Object Oriented Programming (Week 7)

Please refer to my Week 6 slog about Object Oriented Programming as my entry.

Wednesday, 4 March 2015

Object Oriented Programming Concept (Week 6)

Object Oriented programming is a type of programming language that is modeled around objects rather than actions and uses logic rather than memory. Each object can interact with one another, and can be modified while the program is running. This is extremely useful compared to a non Object Oriented programming such as BASIC. In basic, an element is static and cannot be modified outside of the code; hence, we cannot change the element directly. I started coding in grade 10 with BASIC. From grade 11 to 12, I transitioned into learning Java with the program Netbeans. Java was the first Object Oriented programming language that I ever learned and it's also the most useful for two reasons: simplicity and efficiency.

Though I used coded in both BASIC and JAVA, I find that Java is much more efficient and user-friendly. In a program that has repetitive code, it may take hundreds of line for it to be written in BASIC, whereas in Java, such a task could be completed with a maybe a dozen lines. Instances of objects created in Java could easily be modified with a simple method, whereas in BASIC, all instances of the object must be modified within the code itself; hence, if you have a 10000 lines of code for a program, you must go through each instance of the object and change it by hand.

Java is simple in a way where a non-programmer can sort of understand what a specific method or function does. The words used in coding for java can be traced with modern English.

while( x < 20 ) {
         System.out.print("value of x : " + x );
         x++;
         System.out.print("\n");
The above code is a simple while loop and can be translated into a sentence as "while x is less than 20, print the value of x."


Though I have coded in many different languages, I find that Object Oriented languages are  the more useful and efficient type of languages out there. C++, Python, Ruby, and PHP are other famous Object Oriented programming languages that are commonly used in today's society.