Object-Oriented Programming

Just a brief history on what I thought I knew…

OOP

I had just recently switched my major to Computer Science and well the first thing I ever learned about computer science was….you guessed it… proofs. Wait, is that correct? The math course in logics and proofs? Yup. I spent the beginning of my journey to becoming a programmer in a discrete mathematics course. I learned the ins and outs of permutations and combinations. I learned everything there was about logical operators and lattices. I even learned just about everything on boolean, logarithms, ordered sets and modules. To be honest i thought I was wasting my time. I spent countless hours trying to figure out the proofs of so many things, I was driving myself mad. Towards the end of the course, I firmly believed, my logic was so sound it could easily rival Plato. What does all this logic have to do with object-oriented programming? Nothing. Well it does but not how I had originally assumed.


Its About The Objects Not The Logic

The link bellow does some great points in summarizing what I feel I am attempting to say so it might be cool to check it out. I credit them with most of my content since they nailed it on this explanation.


Object-Oriented Programming


So originally programming was a very linear process. I was in college brought up on C++ and well it taught me a lot. Mostly that it takes me about 7 lines to create “hello world” while ruby takes me 1. Secondly that a receipt generator in C++ took me about 35,000 lines, I have yet to try it in ruby but I’m positive it wont take nearly as long.  Anyways back to my point, historically a program has been viewed as a logical procedure that takes input data, processes it, and produces output data.


The idea was very simple, as programmers we care more about the “object” the things we are trying to manipulate rather than how to manipulate them. I’m not going to pretend I was a pioneer in OOP but I’m going to assume that they took their discrete mathematics course and understood the logic and math so well they just wanted to manipulate more complex pieces of information to make programming more useful.


When we say object, literally think of an object, something identifiable with a structure ect. These objects that we wish to manipulate could be generalized to a specific group. For example a lion to animals or a table to furniture. These generalizations could be classified into classes, in a almost similar fashion as we categorize living things. This creation of classes allow many benefits to programming and probably the most importantly is that you can generalize manipulations to classes making things quicker, faster and more complex. Among these benefits are the following:

The concepts and rules used in object-oriented programming provide these important benefits:

  • The concept of a data class makes it possible to define subclasses of data objects that share some or all of the main class characteristics. Called inheritance, this property of OOP forces a more thorough data analysis, reduces development time, and ensures more accurate coding.
  • Since a class defines only the data it needs to be concerned with, when an instance of that class (an object) is run, the code will not be able to accidentally access other program data. This characteristic of data hiding provides greater system security and avoids unintended data corruption.
  • The definition of a class is reuseable not only by the program for which it is initially created but also by other object-oriented programs (and, for this reason, can be more easily distributed for use in networks).
  • The concept of data classes allows a programmer to create any new data type that is not already defined in the language itself.

Things To Keep In Mind

Psuedo-Code!!!!!!!!!!!!!!!!

It’s completely made up but its real.

confused


Wiki to the rescue! “its an informal high-level description of the operating principle of a computer program or other algorithm. It uses the structural conventions of a programming language, but is intended for human reading rather than machine reading. Pseudocode typically omits details that are essential for machine understanding of the algorithm, such as variable declarations, system-specific code and some subroutines. The programming language is augmented with natural language description details, where convenient, or with compact mathematical notation. The purpose of using pseudocode is that it is easier for people to understand than conventional programming language code, and that it is an efficient and environment-independent description of the key principles of an algorithm. It is commonly used in textbooks and scientific publications that are documenting various algorithms, and also in planning of computer program development, for sketching out the structure of the program before the actual coding takes place.”


Mindfulness. It important when creating something beautiful to keep that thing in mind. Psuedo-code allows us to keep a track of all the things we must accomplish systematically in order to make somethings work. Its simply good practice to know exactly what you’re trying to accomplish and exactly how we are trying to accomplish it.


Lastly remember to stay up. Its not easy…. but nothing worth having ever comes easy.

Object Oriented Pogramming