We are testing interview quizzes and created a demo app. Now, We require your help. Please take this quiz and provide inputs for content improvement. Interview Quiz




Code 1: OOPS, class or object.

OOPS-class-objectOOPS-class-object @Image courtesy of digitalart / FreeDigitalPhotos.net


“I am not a computer science graduate”

Yes! This was my innocent submission when i started my career in IT.

I must admit it now that i did use this as an excuse and so do many people to avoid responsibility. I was searching for short-cuts and mugging up things to complete the work assigned to me. But between, i felt that this is not a long-term strategy and i might get entrapped sometime. Recession can make you learn everything boss!!

Later, I wanted to learn but instead of trying very hard,i was not able to understand anything. One of my friend used to teach me and still i was not able to meet the expectation. In sometime, i realized that why i was not able to understand anything. It’s because I was not able to relate to its existence.

When someone used to explain a simple question “What is a class?” , I could not resist to ask  why we need it and where can i find it. I know few people might think that I am complete dumb but they will certainly agree that when we don’t ask basic/simple question,no matter how silly they seem, we are just inviting bigger problems ahead.

Even the same reaction i have seen from people explaining a ‘class’.

I am not saying that i am a good programmer but after all this, i devised my own way to understand the concepts.

I started with the dictionary meaning of OOP [object-oriented programming] . We are talking about a programming concept whose basis is object. And we know that we all are objects, may be living or non-living so the origin of this language is from our environment only.

We also know the dictionary meaning of class and in real life, I am a living object which might belong to human class, middle class, gentlemen class, software developer class etc. I can have attributes and behavior of n number of class.

So, if i try to define class then i can say its a generic structure or a generic template which defines some attributes and behavior. For example, Middle class can have fields like monthly expenditures,monthly savings etc. and behavior like paybill(), dropandpickchildrenfromschool() etc.

Middle class doesn’t have an existence on its own. I am a living object exist as a middle class person in this world and I give meaning to all the fields and perform the behavior associated with middle class.

I hope this article will help someone like me.

Navigation:





4 Responses to Code 1: OOPS, class or object.

  1. Shweta upadhayaya says:

    its really very informative…………………….gud!!!!!!!!!!!! keep it up…

  2. Nick.T says:

    Simply said…
    Now to the next step please ;)
    Maybe you can explain heritage, polymorphism and others I don’t know the name of the same way?

    • Admin says:

      For Sure Nick.

      You will see all the concepts in much simpler form. I will also explain inheritance,polymorphism,abstraction.

      Please send me the request for any question/tutorials you are looking for.

      Thanks
      –CodeSpread