Thursday, February 10, 2011

Object Oriented Programming - Initial Post

As many other people my first contact with programming was by far not an Object Oriented language. In my case my first programming tool was the well remembered “flowchart” (which by the way I think is a great tool to start..) After we developed some logic and understood the very basics of loops, processes and flows then we moved into what it was my first official language which was Pascal, a procedural programming language designed in the late 60's and initially thought as a language to teach students structured programming. As soon as I started loving Pascal and picturing myself as a successful skilled Pascal programmer (I was feeling very confident programming my first very basic console programs), somebody told me well guess what?? Pascal is so old and so useless that nobody uses it anymore other than teaching purposes. Of course I was shocked!! How come??? so now the language which for 6 “long” months I have learned with so much passion is useless??? well yes, said this person!! now what you have to learn is an Object Oriented Programming Language called Java!!

That day, I had the pleasure to meet the well old known programmer's friend called CHANGE. Which up to now always shows up, just as my first days with Pascal whenever I start feeling comfortable using a particular technology (languages, framework, APIs or whatever.. ). Therefore, after being witness of the radical changes that have occurred during the last years I've learned to appreciate the basics of programming and the importance to learn them well; because the basis of programming haven't changed much for 40 years.

As well after that day I heard for the first time the term Object Oriented Programming or OOP for short. To be honest at the beginning it was somehow confusing for me to fully understand it, I used to read about: encapsulation, abstract classes, polymorphism, interfaces, objects, inheritance, and many other terms that I was really not sure what their real purpose was.

The idea of this post is to give an introduction to OOP. In further posts I will be writing about its basic concepts and posting some code examples to exemplify the concepts discussed here. I will be using Java since it is a known programming language among software developers and the one I have more experience with. It is important to note that the topics discussed here are being thought in Java terms, so they might slightly differ from other OO languages. But first some history..

History

The terms “objects” and “oriented” seem to make first appearance at MIT during the late 50's and early 60's in different research projects taking place on this university at that time. However, it is considered to be SIMULA the first object oriented language. As its name suggests it was used to create simulations. Alan Kay, who was at the University of Utah at the time, liked what he saw in the SIMULA language. He had a vision of a personal computer that would provide graphics-oriented applications and he felt that a language like SIMULA would provide a good way for non-specialists to create these applications. He sold his vision to Xerox Parc and in the early 1970s, a team headed by Alan Kay at Xerox Parc created the first personal computer called the Dynabook. Smalltalk was the object-oriented language developed for programming the Dynabook. It was a simulation and graphics-oriented programming language. Smalltalk exists to this day although it is not widely used commercially.

The idea of object-oriented programming gained popularity in the 1970s and in the early 1980s Bjorn Stroustrup integrated object-oriented programming into the C language. The resulting language was called C++ and it became the first object-oriented language to be widely used commercially.

In the early 1990s a group at Sun led by James Gosling developed a C++ based language called Java which was originally designed for interactive television, but it was too advanced for the digital cable television industry at the time. This project was going nowhere until the group re-oriented its focus and marketed Java as a language for programming Internet applications. After that, the language has gained widespread popularity and nowadays is widely used and constantly new languages are being influenced by it (i.e. Python, PHP, C#, SCALA ). Since then Java hasn't stopped evolving and is one of the favorite languages used in the academia and the industry.

For the initial posts I will assume that the reader has never used an OOP language before so I will start defining the most very basic concepts. I think it is a good idea to do so because as I said I really believe that learning the basics and learn them well are going to really help to avoid misunderstandings that can later lead us to get lost on the topic and get frustrated. So having said that, if you are an experienced programmer definitely this will be old stuff for you. However, if you are not I will firstly cover what objects, classes, inheritance, interfaces and packages are. Having done that we will be ready to move to real code examples.

No comments:

Post a Comment