What is Object Oriented Programming?
There are a number of common characteristics which are found in object oriented programming languages. Some of these are the grouping of data and functions, a separation of the interface with the implementation, and the sharing of code. At the most basic level, object oriented programming is a different method of solving problems.
Languages which are designed with the OOP paradigm allow programmers to think in new ways. They will also support inheritance, and instead of using function calls, they will use messages. The goal of a computer program is to alter data. What the program does to the data is more important than how it does it.
When data types are generated, the programmer will want to define what procedures the program can use to alter the variables of the data type. This is called data integrity. In addition to this, the OOP approach is flexible and allows future changes to the structure of the data. An example of this would be when you need to fix bugs or make enhancements. To understand object oriented programming, you will first want to become familiar with the terminology that is used. In OOP, the data types are referred to as being classes. The variable which is attached to a class is called an instance of the class. The procedures which may be carried out by a class are called methods instead of functions.
The next concept that you will want to become familiar with is called messaging. It is possible to ask an object ot carry out a method without needing to know what class it belongs to. Instead of using functions, a message is sent to the object that will make a request for it a carry out the method on itself. The class of the object will determine which code is processed by the computer. This is important because a message may be important to multiple classes of an object. The information that is sent to the object is called a message. Instead of communicating with a function, a message will be sent to the object which will ask it to carry out a method.
There are a number of examples which will allow you to gain a better understanding of the object oriented programming approach. The Unix File System is an example of something that is object oriented. The open ( ) call will take the name of a file as its argument and will return the handle to the file. The open call may initialize a device, and it may also find a disk drive which has the name of the file. There is a switch statement that resides within the kernel, and it can choose the device routine that will be requested base on the name you have given for the file. The other routines will have a code which is similar, and will be responsible for finding the data that is being used. This can be done by sending commands, or it can wait for a serial input to occur. In addition to this, data can be send to the printer.
Because you are the person that will be handling the routines, you will not have to know which operations will be processed by the kernel. The kernel will carry out whatever procedures are necessary in order to finish the request that has been made. Another important concept that you will need to know is inheritance. Classes which are similar to each other may also share a similar code.
A new class can be constructed which will inherit the traits and data from other classes. The interesting thing about this is that a new class will understand the messages which are understood by the class it inherited data from. A new class can respond to a message in a different way than the class that it inherited its data from. In addition to this, it can also generate new methods.
It is also possible for a new class to alter the data that is used to deal with the class that it inherits data from. It can also add to this data. Any class that inherits data from another class is called a subclass. The class it inherits data from is called the superclass