Tuesday, May 5, 2020

Concepts Behind OOP

Question: Is OOP the next step in mimicking human thought? What are the advantages and disadvantages of OOP versus structured programming? For this Discussion, you will analyse these nuances as you attempt to explain OOP to those of a non-technical background. Answer: Introduction: OOP or Object Oriented Programming is a computer programming model that makes use of objects and the interaction between such objects to design a computer program and application. Object Oriented Programming is widely used in modern computing and programming environment due to the close resemblance of its basic approach with the human thinking. In this report the various concepts of OOP are discussed and are compared with the features of structured programming approach. The report also includes merits of OOP in closely replicating human thinking and behavior. Concepts behind OOP: Object: In any OOP program, object is the very basic unit in the programming language. Every object is defined uniquely in the program and has its own data. Each object belong to a class of objects and follows the same characteristic (Pecinovsky, 2013). The relation between a class and an object can be compared to the relation between a college or school class and the students in it as each student has his/her unique identification number and they all represent the class as a whole. Class: In OOP programs, classes are sets of individual objects that fall in the same category. A class is defined based on the data type of the object. This can be explained by the example of a class named cars which includes cars from all manufacturer as regardless of model and manufacturer, every car falls in the same category. Inheritance: Inheritance is a specific concept in OOP program which works in similar way to the real life inheritance which passes through generations within a family. Inherited classes keep the same properties as their parent classes. This concept makes the program code easier and shorter. Polymorphism: in OOP programming, Polymorphism allows one function or operators to act differently or to have multiple functions within the same program. This is similar to a machine gun in a video game having multi-functioning of a ranged weapon as well as a melee weapon. Data encapsulation: Data encapsulation is the approach of hiding a data from direct access, but still having access to it through class functions (Greenberg, 2007). Data Abstraction: Data Abstraction is an OOP concept that makes programming easier by allowing creation of data types by the programmer without presenting additional information. For example- one can define a class of cars without having to define classes of internal parts of a car such as engine, steering, and gearbox. OOP vs. Structured Programming in modern computing: Structured programming is a top down programming approach which follows block oriented structures. This approach tends to divide the code into logical blocks and generally includes loops and conditional statements. Structured programming saves time and energy in coding for straight-forward short programs as the same program would take longer with OOP due to creation of classes and objects. Such programs are also easier to read and understand as there are no jumps to other code sequence or blocks. Structure programming languages lose their advantage over OOP once the programs get more complicated and longer (Marrer, 2009). OOP becomes extremely useful and time-saving when the programs are thousands of lines long as the objects and classes remain defined for use anywhere in the code. Modern computer programming and languages are still years away from a true Artificial Intelligence program. However, among the existing programming approaches, OOP resembles some concepts similar to our brains. OOP classes and data abstraction concepts of OOP programs comes from the human thinking process (Schildt, 2004). References: Greenberg, I. (2007). Processing: Creative Coding and Computational Art. Berkeley, CA: Apress, p.319. Marrer, G. (2009). Fundamentals of Programming: With Object Oriented Programming. Laptop Press, pp.219-220. Pecinovsky, R. (2013). Oop - learn object oriented thinking and programming. [S.l.]: Bruckner Tomas Repin, pp.11-13. Schildt, H. (2004). Java:Tcr, J2Se. 5th ed. Tata McGraw-Hill Education, p.16.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.