Introduction to Object Oriented Programming

Object-Oriented programming

To introduce c-sharp let me first introduce what is object oriented programming(OOP).

Object

Oriented Programming is one of the most popular methodologies in software development. It offers a powerful model for creating computer programs. It speeds the program development process,improves maintenance,and enhances reusability of programs. An object Oriented program consists of classes, object, and methods.
The Object Oriented methodology in software development revolves around a single concept called "OBJECT".

An Object is a combination of message and data. Objects can receive and send messages and use messages to interact with each other. An Object has the following characteristics:

  1. It has a state.
  2. It may display behaviour.
  3. It has a unique identity.

For example a cellphone has states: off, ring, vibrate, and call.

The behaviour of an object can be understood with the example of a car: accelerate, deaccelerate, turn right or turn left are its behaviour.
Each object has a unique identity, and the identity of an object distinguishes it from all other objects. The car also has an identity such as unique registration number.

Note

Two objects can have same state and behaviour but they will never have same identity.

Classes

A class may be defined as a declaration, a blueprint or a template that can be used to classify objects. All animals and Birds which are essentially objects , can be classified on the basis of their common attributes.
For example, the peacock, the sparrow, and the kingfisher are all birds. All of them share characteristics that are common to the family of birds. Therefore they have structural and behavioral similarities and belong to the class Birds.

The features of object-oriented approach are:

Realistic Modeling - Because we live in a world of objects, it logically follows that the object-oriented approach models the real world more accurately.
Reusability - The process of creating a new class by adding some features to an existing class is known as inheritance. The benefit of reusability translates to savings in time and effort, which in turn results in cost benefits.
Extensibility - This is often known as "Resilience to change". It results in easier maintenance. The ability of a class to inherit features from another class also makes object-oriented programs more extensible.
Existence as different forms - Using an object-oriented approach, objects can be made to respond differently to the same message. The response is decided based on the information or parameters provided with the message.

I will discuss "Creating objects in c#" in my next article.
 

Next Recommended Reading Introduction To Data Transfer Object