Object-oriented programming concept (OOP) is an approach to software development in which the structure of the software is based on objects interacting with each other to accomplish a task. This interaction takes the form of messages passing back and forth between the objects. In response to a message, an object can perform an action or method.
Users of software programs are isolated from the logic needed to accomplish a task. For example, when you print a page in your word processor, you initiate the action by clicking a print button. You are isolated from the internal processing that needs to occur; you just wait for a response telling you if it printed. Internally, the button object interacts with a printer object, which interacts with the printer to accomplish the task of printing the page.
Object-oriented programming concept started surfacing in the mid-1960s with a programming language called Simula and further evolved in the 70s with the advent of Smalltalk. Although software developers did not overwhelmingly embrace these early advances in Object-oriented programming languages, object-oriented methodologies continued to evolve. In the mid-80s there was a resurgence of interest in object-oriented methodologies. Specifically, Object-oriented programming languages such as C++ and Eifle became popular with mainstream computer programmers. Object-oriented programming concept continued to grow in popularity in the 90s, most notably with the advent of Java and the huge following it attracted. And in 2002, in conjunction with the release of the .NET Framework, Microsoft introduced a new Object-oriented programming language, C# (pronounced C-sharp) and revamped Visual Basic so that it is truly an Object-oriented programming language.
Why has the Object-oriented programming concept developed into such a widely used paradigm for solving business problems today? During the 70s and 80s, procedural-oriented programming languages such as C, Pascal, and Fortran were widely used to develop business-oriented software systems. Procedural languages organize the program in a linear fashion—they run from top to bottom. In other words, the program is a series of steps that run one after another. This type of programming worked fine for small programs that consisted of a few hundred code lines, but as programs became larger they became hard to manage and debug.
In an attempt to manage the ever-increasing size of the programs, structured programming was introduced to break down the code into manageable segments called functions or procedures. This was an improvement, but as programs performed more complex business functionality and interacted with other systems, the following shortcomings of structural programming methodology began to surface: Programs became harder to maintain, existing functionality was hard to alter without adversely affecting all of the system’s functionality, new programs were essentially built from scratch (consequently, there was little return on the investment of previous efforts), it was hard to translate business models into programming models and It worked well in isolation but did not integrate well with other systems.
As a result, many business software developers turned to object-oriented methodologies and programming languages to solve these problems. The benefits included the following: a more intuitive transition from business analysis models to software
implementation models, the ability to maintain and implement changes in the programs more efficiently and rapidly, the ability to more effectively create software systems using a team process allowing specialists to work on parts of the system, the ability to reuse code components in other programs and purchase components written by third-party developers to increase the functionality of their programs with little effort, better integration with loosely coupled distributed computing systems, improved integration with modern operating systems and the ability to create a more intuitive graphical user interface for the users.
Now we are going to look at some fundamental Object-oriented programming concepts and terms common to all Object-oriented programming languages. How these concepts get implemented in any particular programming language; that will come later. My goal is to merely familiarize you with the concepts and relate them to your everyday experiences in such a way that they make more sense later when you look at Object-oriented programming design and implementation.
We live in an object-oriented world. You are an object. You interact with other objects. In fact, you are an object with data such as height and hair color. You also have methods that you perform or are performed on you, such as eating and walking.
So what are objects? In Object-oriented programming concept, an object is a structure for incorporating data and the procedures for working with that data. For example, if you were interested in tracking data associated with products in inventory, you would create a product object that is responsible for maintaining and working with the data pertaining to the products. If you wanted to have printing capabilities in your application, you would work with a printer object that is responsible for the data and methods used to interact with your printers.
When you interact with objects in the world, you are often only concerned with a subset of their properties. Without this ability to abstract or filter out the extraneous properties of objects, you would find it hard to process the plethora of information bombarding you and concentrate on the task at hand. As a result of abstraction, when two different people interact with the same object, they often deal with a different subset of attributes. When I drive my car, for example, I need to know the speed of the
car and the direction it is going. Because the car is an automatic, I do not need to know the RPMs of the engine, so I filter this information out. On the other hand, this information would be critical to a racecar driver, who would not filter it out. When constructing objects in Object-oriented programming applications, it is important to incorporate this concept of abstraction. If you were building a shipping application, you would construct a product object with attributes such as size and weight. The color of the item would be extraneous information and filtered out. On the other hand, when constructing an order-entry application, the color could be important and would be included as an attribute of the product object.
Another important feature of Object-oriented programming concept is encapsulation. Encapsulation is the process in which no direct access is granted to the data; instead, it is hidden. If you want to gain access to the data, you have to interact with the object responsible for the data. In the previous inventory example, if you wanted to view or update information on the products, you would have to work through the product object. To read the data, you would send the product object a message. The product object would then read the value and send back a message telling you what the value is. The product object defines what operations can be performed on the product data. If you send a message to modify the data and the product object determines it is a valid request, it will perform the operation for you and send a message back with the result.
By encapsulating data you make the data of your system more secure and reliable. You know how the data is being accessed and what operations are being performed on the data. This makes program maintenance much easier and also greatly simplifies the debugging process. You can also modify the methods used to work on the data, and if you do not alter how the method is requested and the type of response sent back, then you do not have to alter the other objects using the method.
Polymorphism is the ability of two different objects to respond to the same request message in their own unique way. For example, I could train my dog to respond to the command bark and my bird to respond to the command chirp. On the other hand, I could train them to both responses to the command speak. Through polymorphism, I know that the dog will respond with a bark and the bird will respond with a chirp.
How does this relate to Object-oriented programming concept? You can create objects that respond to the same message in their own unique implementations. For example, you could send a print message to a printer object that would print the text on a printer, and you could send the same message to a screen object that would print the text to a window on your computer screen.
In Object-oriented programming concept, you implement this type of polymorphism through a process called overloading. You can implement different methods of an object that have the same name. The object can then tell which method to implement depending on the context (in other words, the number and type of arguments passed) of the message.
Most objects are classified according to hierarchies. For example, you can classify all dogs together as having certain common characteristics such as having four legs and fur. Their breeds further classify them into subgroups with common attributes such as size and demeanor. You also classify objects according to their function.
You use inheritance in Object-oriented programming concept to classify the objects in your programs according to common characteristics and function. This makes working with the objects easier and more intuitive. It also makes programming easier because it enables you to combine general characteristics into a parent object and inherit these characteristics in the child objects.
Aggregation is when an object consists of a composite of other objects that work together. For example, your lawn mower object is a composite of the wheel objects, the engine object, the blade object, and so on. In fact, the engine object is a composite of many other objects. There are many examples of aggregation in the world around us. The ability to use aggregation in Object-oriented programming concept is a powerful feature that enables you to accurately model and implement business processes in your programs.
It is good to learn all these theories, but one can ask the point of learning them if you don’t know how to put them into practice. These need to give us some benefits, right? Therefore, I thought that I should demonstrate the use of these concepts at least in one concrete project.
When you talk about designing a software system, the correct handling of Object-oriented programming concept is very important. I have made the above article richer with the idea but still kept it short so that one can learn/ remind all of the important concepts at a glance. Hope you all will enjoy reading it.