In order to better understand object oriented programming (OOP) this paper will discuss the similarities and differences between OOP and procedural programing (PP). It will also provide information on four basic object oriented concepts of objects, classes, methods, and polymorphism. The some similarities of these two programming paradigms are that they both use algorithms to process data to solve problems to achieve the desired result.
The basic way to define the difference between PP and OOP is to think of PP as a liner process and OOP as an abstract process, although OOP has liner processes imbedded in it. Kuker, 2009) OOP is challenge for me at this time because I am comfortable with a liner process as I imagine many of us are. A top down design is easy to understand for me; however it may not be the most efficient when designing a program. Due to inheritance in OOP code can be reused and prevents the same code having to be written multiple times throughout a program. The base of OOP is objects, hence the name. Think of objects as nouns such as a car.
Cars can be broken in different categories such as economy, sedan, sport and many other shared attributes of cars all these attributes combined are referred to as the car’s state and are stored in fields. All cars as behave in the same manner also by going forward, stopping, reverse, turning, etc. These behaviors are functions of the car allowing it to perform tasks, in Java we calls these methods. (The Java Tutorials> Learning the Java Language > Object -Oriented Programming Concepts) Objects inherit state and behavior from its class. If a car is an object it class could be an automobiles.
All automobile share some common state such as wheels, engines, and color to name a few. To help clarify this further anther object in a class of automobile could be a truck. Polymorphism means many forms and refers to ability of inheritance that we have discussed. (Johnson, 2007) Object-Oriented Programming is certainly different that Procedural Programming and I have only scratched the surface of these differences; however these basic differences allow certain advantages of OOP such as modularity, information hiding, and reuse of code and ease of debugging.
Johnson, R. A. (2007). An Introduction to Java Programming and Object-Oriented Appilcation Development. Boston: Bob Woodbury. Kuker, B. (2009, 07 29). Procedural vs. Object-Oriented Programming. Retrieved 04 10, 2013, from Virtuosi Media: http://www.virtuosimedia.com/dev/php/procedural-vs-object-oriented-programming-oop The Java Tutorials> Learning the Java Language > Object -Oriented Programming Concepts. (n.d.). Retrieved 04 10, 2013, from Oracle: http://docs.oracle.com/javase/tutorial/java/concepts/index.html