Object Oriented Programming
Wikipedia Object Oriented Programming
An object in computer science will generally be a structure that contains data, with methods that are able to modify that data, among other things.
Objects and Classes
Almost all object oriented programming languages use classes for creating object. These classes provide a blue print for the kind of data the object will accept, and the implementation of it's methods. Thus, multiple objects that are created by the same class will have the same type and will be known as instances of that class.
Objects are often useful for representing things in the real world. A cars, for example, has an attribute for its current speed. It also has interfaces for changing its speed. Likewise, a web app will have different objects, such as users, posts, comments, etc., all having a state and methods for changing the state (editing the content of a comment, for example).
The state of an object is stored in variables. The state of a variable can be shared between all instances of a class (class variable), but most are scoped only within that individual instance of the class (instance variable). Class methods (also known as static methods) belong to the class as a whole, and aren't generally called on an instance, but on the class object, or within an instance. Instance methods will be called on a particular instance.
Dynamic dispatch
Due to polymorphism, many different objects will implement a method with the same name (see below). With dynamic dispatch, an object is given the responsibility at run time to internally choose which implementation to call. Thus, the rest of the program outside of the object will not necessarily know or care what was implemented. For example both an integer and a float will have a divide method that operates differently. The rest of the code around that operation won't depend on how a value is being divided.
Typed and weak/untyped languages will have different dispatch mechanisms. A divide operation will depend not just on the dividend, but also the divisor (which is usually passed as an argument to the method). A float divided by an integer should return a float, and an integer divided by a float should also return a float. In typed languages, the type of the arguments is given, but dynamic languages often need to carry a dispatch table.
Encapsulation
OO languages generally allow certain attributes and methods of an object to be hidden from other objects. This allows for granular control over the public interface of an object so that it can be used only as the programmer intended. Encapsulation encourages decoupling since objects will not be aware of the internal implementation of another object, and thus allow for changes to objects that do not cascade throughout a codebase.
Composition
Object composition occurs when objects are passed as instance variables to other objects. This allows for one object to be composed of one or many other objects (a has-a relationship), or many types of objects. A post on a forum can be composed of many comments, a user, and many tags.
Inheritance
Inheritance allows classes to automatically copy the attributes and methods of parent classes, and potentially modify and extend them. This generates a hierarchical "is-a-type-of" relationship. For example, a Dog is a type of Animal, and so is a Cat. Both can inherent the attributes and behaviors of a generic Animal, and then extend them by defining attributes and methods that are specific to Dogs and Cats, respectively.
Some languages allow classes to inherit from multiple classes. Some allow for mixins, which means it integrates the methods of another class into it's own interface.
The use of multiple inheritance and mixins is discouraged, and you should generally prefer composition instead of inheritance, when possible. Composition grants a higher degree of flexibility. A complex family tree can quickly become unwieldy since some siblings may have commonality that others do not, and thus may force you to either duplicate code or add additional parent classes.
Delegation
An object can delegate certain behavior to another object. This will generally mean accessing an attribute, or calling a method, will result in the original object sending the context of the call to the other object, which will invoke the asked for member using its properties. This will allow for behavior that mimics inheritance, but with greater flexibility. For example, a Message object that does not implement a dismiss method, but it may delegate it to a Notification object. So, a call to message.dismiss() would set notification's viewed property to true.
Polymorphism
Polymorphism is when code is agnostic to the type of object it is calling. This happens when multiple objects have the same interface. For example, multiple classes may implement a simple call method. An array of instances of different classes can then be iterated over, each being _call_ed. Subtyping is a form of polymorphism which applies to the parents and descendants of classes. In it, the calling code is indifferent towards making a call on either.
Open Recursion
Methods in objects are usually able to refer to attributes and other methods belonging to the same object using the this or self keyword, even if the other method is defined later on.