Basic Object Oriented Concepts

What is an Object?

Concept wise, it is a set of tightly related responsibilities.

Specification wise, it is a set of methods, events and properties.

Implementation wise, it is functionality and state, and the computational interactions between those.

What is a Class?

In most general usage, it is the specification for a type of objects. A class define structure and functionality for objects as well as relationships with other objects.

An instance of a class is an object of the type defined by the class.

An Abstract Class is a template for other classes with identified and constrained variability of functionality.

A Parameterized Class is a template for other classes with identified and constrained variability of structure.

A Sealed Class is a class that constrain establishing inheritance type relationships.

A Static Class is a class that cannot be instantiated but could expose functionality and state.

A Meta Class is a type of class, of which it's instances themselves are classes. A meta class define a template for other classes.

Not many languages support meta classes.

What is an Instance?

An instance is an actual object created to the specification defined by a class.

What is an object oriented software?

A software system that models a solution using objects and computational interactions among those objects.

What is Abstraction?

Selecting a subset of options based on commanality in a given context.

What is Encapsulation?

Decoupling of specification from implementation.

What is Inheritance?

Inheritance is a relationship between two classes, where the class on one end is called Base Class or the Super Class (sometimes Parent Class) and the class at the other end is called Derived Class or the Specialized Class (and, sometimes Child Class). This relationship is also called a "is a" type of a relationship.

When two classes establish this type of a relationship, the derived class becomes a specialized version of the base class. For example, a carbon pen is a specialized version of the pen class, and a specific type of carbon pens made by Parker is a specialization of the carbon pen class.

What is Aggregation?

Aggregation is another type of relationship between two classes, where the class on one end is used in the structure of the class in the other end.

The term aggregation is generally used when a given object is structured using other objects but nonexistence of those objects does not affect the existence or purpose of the given object.

A Monolithic object is an object that does not in it's public interface show any sign that it is made up with other objects. Consumers of such an object has no knowledge of or a way to access the objects that are used in forming the Monolithic object. It is said, that a monolithic object could be thought of only as a cohesive whole.

A Composite object is an object which is composed using other objects and is evident through the public interface of it. The existence of composed objects (the objects used to compose the composite object) directly affect the existence or the purpose of the composite object.

Due to the differences in strength of coupling, aggregation and composition are represented using different notation in modelling languages such as UML.

What is Reference?

Reference is the weakest type of relationship between two classes, where the class on one end has knowledge of the class in the other end but it is not part of its structure.

What is an Interface?

An Interface is a public specification of a class. It define the publicly visible structure and publicly visible operations of a class.

Programming languages provide mechanisms to define interfaces, to be implemented by classes. If a class implements an interface, it implies the class has (but is not limited to) the same public structure and operations defined by the interface.

What is Overloading?

Overloading is conceptually, providing multiple interfaces to the same operation. In implementation, there's no constraint that the functionality of the operation should be the same. But conceptually, the end result should be the same.

What is Overriding?

Overriding is providing a different implementation to an operation in a derived class over an existing implementation in it's base class.

A Virtual Operation is an operation written with provision for a derived class to override that operation.

An Abstract Operation is an operation definition written, without an implementation, enforcing the derived class to provide an implementation.

A Sealed Operation is an operation that prohibits derived classes from overriding it.

What is Polymorphism?

Polymorphism at words worth is the nature of having multiples of the same.

Polymorphism is two fold, compile time polymorphism and runtime polymorphism. <<To be expanded>>

Beauty of polymorphism is the ability to work with multiples by having the knowledge of just what they are.