Thursday, December 24, 2009

What are the basic concepts of object oriented programming?

I'd review this Wiki entry for the basics. You could also find this info in just about any object oriented programming book. Check the Fundamentals section for a brief description of the concepts.What are the basic concepts of object oriented programming?
A rather large question, but here are the fundamentals.





Object Oriented Programming (abbreviated OOP) is a design philosophy. Instead of thinking of a program as a collection of functions it is thought of as a collection of objects. Each of these objects contain ';methods'; it uses to accomplish a task. Objects derived from a parent class inherit the methods of the parent class. However, if necessary they can make their own object specific implementation of a particular method and they can implement new ones if necessary.





Pros - Promotes code re-use


Cons - Usually increases code footprint





For example, you can have an ';Automobile'; class with a ';shift gears'; method. From that base class you can derive a ';Luxury sedan'; and a ';sports'; class. The ';shift'; method of the ';Luxury sedan'; does all of the things necessary for an automatic transmission while the ';shift'; method of the ';sports'; class does the things necessary for a standard transmission. The program that uses these objects really doesn't care about the details of shifting, all it does is call the shift method of the object mycar-%26gt;shift(...) and regardless of whether ';mycar'; is a Luxury sedan or a sports car the right thing happens to cause it to shift gears.What are the basic concepts of object oriented programming?
People can really get caught up in the complexities of OO and start to think it is too complex for their application or requires too much code, etc.





As a paradigm though, we are just talking about building small things (objects) that represent real things in regards to an application. The small things contain knowledge of themselves and can do small things related to themselves.





The goal is is simplification.





Yes, there may well be inheritance, encapsulation, and other cool buzzwords but it boils down to simplifying our design that is supposed to represent ';Real Life.';





If in our real life Car Maintenance world we have cars, customers and mechanics...then in our software application meant to manage that world we would probably had Car, Customer and Mechanic objects. See?





To me, that is the basic concept. If you pick up any good book on OO it will not start with a definition of encapsulation or polymorphism but rather try to explain how the basic premise is to manage complexity.





Good Luck!
Encapuslution


Data abstraction


Polymorphism


Inheritence
With object oriented programming you use objects that you can call functions from. Like having an employee of which you give an assignemt.





Objects are described by classes, like a job description for and employee.





classes define functions and what variables exist for a particular object type , but they do not define the actual data stored in variables. Instances are objects of a certain class with their own unique data.





Its like a job application for an employee type (programmer, janitor secretary) you define the job description and requirements thats like you defining a class. a person fills it out with their info, gets hired , now you have an instance of your employee type with information particular to that person(Name, education , age )





You can ask your employee to do a task(calling a function from an object instance)





The object oriented model i feel can be explained clearly using this model. But that is the most basic idea of it in clear English that i can make it.
there are 8 concepts of oops,they are as follows


1.classess


2.objects


3.data abstraction


4.polymorphism


5.inheritance


6.encapsulation


7.dynamic binding


8.message communication
in general, inheritance, abstraction, polymorphism, and encapsulation. Definitions? Too long for me to plagiarize :)

No comments:

Post a Comment