You are on page 1of 4

Object Oriented Programming Introduction

Object Oriented Programming, also known as OOP, is a computer science term which is used to describe a computer application that is composed of multiple objects which are connected to each other. Traditionally, most computer programming languages were simply a group of functions or instructions.

With OOP, every object can handle data, get messages, and transfer messages to other objects. The objects will all act as independent units in their own right, and they will be responsible for carrying out a certain process. Because the objects are not dependent on each other, OOP is seen as being more flexible than older methods of programming. It has become quite popular, and it is now used in a number of advanced software engineering projects. Many programmers feel that object oriented programming is easier for beginners to learn than previous programming methods. Because it is easier to learn, it can also be analyzed and maintained without a large amount of difficulty. However, there are some people that feel that OOP is more complicated than older programming methods. To understand object oriented programming, there are a few concepts you will need to become familiar with. The first concept that you will need to learn is called a "class." A class creates the attributes of a thing, and it will also define the processes that the thing can carry out. For example, a class called "cats" will have the attributes which are commonly found with cats, such as the ability to purr. A class will bring about modularity within the objected oriented computer application. Someone who is not a programmer should be able to find a class. The reason for this is because the attributes of the class should be something that will make sense to them. It is also important for the code of a class to be self contained to a certain degree. When code is written with relevant names, it will be easier to understand. Making sure the code is self-contained will allow one part of the application to be updated without needing to change the other parts. It is this modularity that makes OOP an effective programming method. It will also help the application solve the problems that it was designed for. The next concept that you will want to become familiar with is an "object." An object can be defined as a specific instance of a class. As an example, while the class Cats will provide all the attributes that are found in all cats, the "object" named Betsy is a specific cat. While it shares the same attributes which are found in all cats, it has fur with a unique color. In object oriented programming, a programmer would say that the object Betsy is a run-time instance of the class Cats. A class may also be devided into sub-groups. Certain variations of a class may not be a specific object. The class Cats may have a sub-group which consists of multiple cat breeds. For example, if Betsy were a Persian cat, it would be an instance of the Persian cat sub-group. Every object within an OOP language will share some attributes with the parent class, but it will also have unique attributes as well. The next concept that you will want to become familiar with is "method." A method may also be called a "message" and can be defined as the abilities of an object. Because Betsy is a cat, Betsy can purr. Because of this, "purr" is a method that Betsy has.

Ads

Betsy may have a number of other methods. When a method is used within an object oriented programming language, it will only affect a single object. This is true even if the method is designed for the entire class. While all cats can purr, you will only need one cat to do it. Methods can further be broken down into commands, callbacks, or queries. A query will tell you about the state of the object, and a command will cause that object to carry out a task. A callback is a method that is composed of a part within an object. The part will notify its parent that an event has taken place, and the object may need to react to the event.

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. Ads
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 to 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 super class.

Object Oriented Programming Concepts


Three of the most basic concepts for object oriented programming are Classes, Objects, and Methods. However, there are a few more concepts that you will want to become familiar with. These are Inheritance, Abstraction, Polymorphism, Event, and Encapsulation. In this article, I will be using the class Cats as an example. Inheritance will allow a sub-group to make a connection with the associates of its parent class. For example, lets say the class Cats decides to create a method called purr() and a property named Colorfur. As the name implies, a property is a specific attribute which is connected to an object.

Every sub-group will be able to inherit the associates, and this means the developer only needs to create the code for them one time. The traits that are inherited by the sub-group can be changed. For example, the Persian cat class may choose to make the Colorfur white for their default color. In contrast, another cat breed may choose a different Colorfur trait. It is also possible for the subgroup to add new associates. If a specific cat Class sub-group wants to set a default eye color, this can be inherited as well. Some object oriented programming languages may also allow a class to inherit traits from multiple ancestors, and this is called multiple inheritance. Some programs may not allow this. The next concept that you will want to be familiar with is called "abstraction." Abstraction can be defined as the process in which an application will ignore the characteristics of a sub-group and work on a general level when it is needed. As an example, Betsy the cat may be treated as a cat when it is necessary, but she may also be processed as a Felidae, which is a superclass of cat family. Polymorphism is an important concept of object oriented programming that you will want to become familiar. It can be defined as a behavior which is dependent on the class to which it is connected. As an example, if a Cat is sent a command to speak, this may cause it to purr, while a dog will bark, or a lion may roar. Anyone who is interested in object oriented programming will also need to know encapsulation. Encapsulation will allow a class to hide information from objects that may use the code. For example, the Cat class will have a purr() method. A code will be written which will explain how the cat purrs. Despite this, it is not necessary for Betsy the cat to know how she purrs. Encapsulation makes it easier for the developer to change the code without having to change the code for Betsy. When the structure of class is hidden, it is harder for it to be used in the wrong way. Encapsulation will basically state which class is allowed to use the members of a certain object. This concept makes it easier for programmers to deal with or avoid errors when developing a program. The members within OOP can be categorized as being protected, public, or private. The last concept that you will want to become familiar with is called an event. An event can simply be defined as anything that happens to an object. Generally, an event is something that will cause the object to react with a method. Another term that advanced programmers may run into is called multiple inheritance. It is a situation where a class is able to inherit traits from a number of different superclasses. A multiple inheritance can create a number of perplexing situations. Because of this, there is debate in the programming community about whether it is beneficial or risky. One example of a program which deals with multiple inheritances is Java. Ads
It will permit a class to have interfaces which come from multiple parents, but it can only inherit methods from a single parent. Other programming languages which use this approach are C# and Visual Basic. It is important to understand the various concepts which are connected to object oriented programming. Once you understand the concepts, you will be equipped to begin learning specific OOP languages. There are a number of popular object oriented programming languages that are being used, and one of the most popular is Java.

You might also like