Basics of OOPs (Object Oriented Programming System)


Object Oriented Programming system or OOPs or OOP model come into light when the 'Structural Programming Methodology/Approach' had been became unsuccessful to manage large chunk of codes and could not able to much help in 'reusability' of existing code & as well as in 'performance'. Also 'security' of data could not be maintained effectively. Lets start with understanding what is actually OOP system.

Property & Behaviour

Lets take 'Property' first. I would like to mention a thing that this property has close resemblance with that either any one has seen in rich tools set of C# 3.0. However, it is also better known by the name of 'data member' or 'variable' of any class. Some people from programming community also refer them as 'field'. Whatever, the work of this thing is same- 'to hold the value at any memory space defined by compiler.' As I mentioned earlier a resembling concept that also termed as 'properties', has the same points, but in a more streamlined way. We will see that sooner, that, how it has boosted the ordinary field/data member thing.
    Now take 'Behaviour', by the dictionary meaning as we all know the meaning of this as- "manner of doing something" is also applicable in this programming world. Lets see how- "it tells the compiler how one task is going to be perform by you." 
    E.g. you want to add two digits, then you will write a method in which you would tell the compiler about two properties/fields/data member which are carrying the value in digits. Next step is, you will let understand this dumb compiler about the '+' operator, using which we perform task of addition. 
    And also you would tell it to print, to display the result.
let it see in pseudo programming way-
type methodAdd()
     type fieldNumber1 = 10;
     type fieldNumber2 = 5;
     type holdTheResult = fieldNumber1 + fieldNumber2;


Speaking in some practical language-"Class  is helpful in creating user define type".
it is basically a grouping of property and behaviour. It may lack any of one thing that is either property or behaviour or may contain both.

We create a class in which used to define its data member & methods.

(just  a random example)

  class class_name
    type member_name_one;
    type member_name_two;
    type member_name_three;

    accessibility type methodname_one();
    accessibility type methodname_two();


An object is like a juice of orange. Just is the case here, when a C# compiler get instruction of making an object it takes its orange that is "class" and crush it- technically to instantiate, irregardless of which type of data member or methods it contains, in the computer memory.

So far we have seen very basic things about OOPs. After this, there are 4 very important pillar of OOPs which have given its the true reputation, for which today we are doing this hardwork. Well no prank please, these pillar could be known as- "A PIE"
Let's see what this acronym speaks-
                A        Abstraction
                P        Polymorphism
                I         Inheritance
                E        Encapsulation

These terms are very simple at all. Lets see how


I would like to ask a question first, "Do you need to know the details about how your computer/laptop/mobile is rendering you this blog?", answer of each reader would be probably - "NO"  and off course we need not. Because, it is just rendering what we need without showing the inside details of how its LCD/TFT/CRT is getting power and all... This is all "Abstraction", i.e. hiding the complexity.


I would like to tell you a scenario and would not ask any question now, I have a pet- "dog"... when my dog smells  a "cat"- it barks and runs after it and similarly, when it smells a "bread"- it comes near to it and salivate over it...
So, there one thing is common- My dog- and there are two different action on smelling.
This scenario is exactly what polymorphism states- "one thing many forms" - one dog two action over smelling something.

Now lets take it in programming way, you would have two method which share same name but different parameters or signatures.


Whenever, it is used in a family, that a newborn arrives there, they closely inspect the feature of baby, that is "Eyes" of baby, from whom it has resemblance (either to mom or daddy) or may be from whom nose of baby resemble, etc. This is same in this programming concept.

You create another class based upon one another class. technically we say it extending the the feature of one class into another.
The class which helps other class(s) to get extend from it, is knows as Parent/Base/Super class. The next one (other) is known as Child/Derived class.


have you ever seen a chocolate without any wrapper, off course NOT, it is the same as here. The binding of data member and methods in a single unit, i.e. class , is Encapsulation.

Further reading...

So dear readers, further, if you are running your mind about overriding and overloading and all other then just take a breath for a while... because we will come across this terms in other post. And all these terms are related to these 4 OOPs features. 
For sure I am going to explain all these right here (in other post).



* You all are welcome to express your views as comment in the box given below of this post. 

* I have not made any special conditions to write here your comment but you may write whatever your heart speak out loud in your inner-self.

* This blog space is continuously in writing/edit mode, kindly keep visiting for a full version]

Post related to CSharp programming

No comments:

Post a Comment

Search This Blog

Let make your friend aware about this post