Replies To: What's the purpose of Object Oriented Programming?

Re: What's the purpose of Object Oriented Programming?

Posted 23 February 2010 - 07:50 PM

look
when object oriented programming was not invented then programmers used procedural programming methods
i.e. whole program was just one part and the sequential flow of the program was there
the programs were not so much readable and if there was some big problem to solve then programmers needed to code in a hectic way as no grouping facilities were there.
In object oriented programming, we can form groups of code for specific purpose, those are called as methods
and we can create the objects those are instances of the classes we have created. These objects can call the methods of respective classes
also
the object oriented programming concepts allow us to use some features like data encapsulation which allows us to protect our data from outer methods, concept of polymorphism which allows us to use same method name for different purposes and many features
If you want some more information about OOP then visitthis link

Re: What's the purpose of Object Oriented Programming?

Posted 23 February 2010 - 08:29 PM

The purpose is to Model Real World Objects and keep the descriptions and definitions of them specific to those objects. Allowing programs to incorporate many objects and instances of objects. There is definitely better descriptions than this, however thats how i have basically deduce my own definition of Object Oriented Programming.

An object is actually a discrete bundle of functions and procedures, all relating to a particular real-world concept such as a bank account holder or hockey player in a computer game. Other pieces of software can access the object only by calling its functions and procedures that have been allowed to be called by outsiders. A large number of software engineers agree that isolating objects in this way makes their software easier to manage and keep track of. However, a not-insignificant number of engineers feel the reverse may be true: that software becomes more complex to maintain and document, or even to engineer from the start. The conditions under which OOP prevails over alternative techniques (and vice-versa) often remain unstated by either party, however, making rational discussion of the topic difficult, and often leading to "religious wars" over the matter.

Re: What's the purpose of Object Oriented Programming?

Posted 23 February 2010 - 10:06 PM

POPULAR

pdkharkar, on 24 February 2010 - 01:50 AM, said:

look
when object oriented programming was not invented then programmers used procedural programming methods
i.e. whole program was just one part and the sequential flow of the program was there
the programs were not so much readable and if there was some big problem to solve then programmers needed to code in a hectic way as no grouping facilities were there.
In object oriented programming, we can form groups of code for specific purpose, those are called as methods
and we can create the objects those are instances of the classes we have created. These objects can call the methods of respective classes
also
the object oriented programming concepts allow us to use some features like data encapsulation which allows us to protect our data from outer methods, concept of polymorphism which allows us to use same method name for different purposes and many features
If you want some more information about OOP then visitthis link

@pdkharker - this is one of the biggest loads of garbage I have read in a long time. Do not discuss things that you have absolutely no idea about.

Let me introduce you to the world of procedural programming, where you will be surprised to learn that things like data encapsulation not only existed but were used extensively by those programmers who coded in a hectic way. In this world, where grouping factilites existed, and the whole program was written into managable chunks called sub-programs. Where grouping facilities and polymorphism existed for those who understood what it was and how to implement it. In fact the only feature in the current implementation of C++ that did not exist was operator overloading.

What C++ and object-oriented programming achieved was the ability to expressutilize all the things we had before, but in a more expressive manner through the language itself. Nothing more and nothing less.

You may be surprised to learn that your C++ programs, in all their glory are compiled into assembler (which is most certainly not an object-oriented language) and on into machine code. It is executed on a processor that performs instructions sequentially, calling subroutines just like it did when executing those one part, not so readable, hectic programs consisting of one part. In fact, most C++ compilers are not written in C++.

Re: What's the purpose of Object Oriented Programming?

Posted 23 February 2010 - 10:41 PM

@Martyn.Rae
Thank you for the information sir
I just posted according to my knowledge
well I am not an expert like you
I just tried to help to the best
Thank you for personally giving me the suggestion
and also... even you can punish me for wrong posts
I don't mind
I just want myself improved day by day!
really thank you for that!
I am clicking the "Green Plus Sign"

Re: What's the purpose of Object Oriented Programming?

Posted 25 February 2010 - 04:36 AM

Martyn.Rae, on 23 February 2010 - 11:06 PM, said:

In fact the only feature in the current implementation of C++ that did not exist was operator overloading.

Aw, come on, there's more than that... ok, at least from C to C++, you're ultimately talking loads of syntax sugar. A fundamental element of all OOP languages is the implicit association of a procedure with a structure. e.g. "void add(List *list, int n)" v.s. "void List::add(int n)". For OPP in pure C, you can pull this off to some extent with function pointers; you always have to the "this." Curiously in C you can even pull off encapsulation, just using files rather than pure syntax.

This point is, agreeing with Martyn, the idea of OOP can be implemented in non OOP languages. Conversely, a strong OOP language like Java can be written completely procedurally ( the static, it burns.) Programming paradigms can be reinforced by language design, but are not exclusive to them. The languages come after the idea, after all.

Assembly is a language; without it you can program in machine code. Most assembler commands map one to one to machine commands. But there is some extra syntax there, like labels. An adept programmer can use procedural and even OO concepts in assembler. It just takes more effort.

Martyn.Rae, on 23 February 2010 - 11:06 PM, said:

You may be surprised to learn that your C++ programs, in all their glory are compiled into assembler (which is most certainly not an object-oriented language) and on into machine code.

It's probably worth noting, most C++ implementations preprocess all that pretty C++ code down to C, then down to assembler.

Re: What's the purpose of Object Oriented Programming?

Posted 25 February 2010 - 11:58 AM

OOP is just a way of approaching program design that tries to group both data and code into a single abstraction (called an "object") that "models" something.

So in OOP I might create a class "Bird" that models a bird for my application. The class might have several data members that describe the bird such as species, color, etc. Then it may have different methods that model how a bird might behave (within the context of what is being modeled) -- fly(), walk(), eat(), chirp() etc....

The purpose of OOP is to organize a program's structure so that one can build programs using these abstract models called "objects" that encapsulate data and behavior into one unit. This allows one to work with code that is a little more connected to the actual problem space and a little more abstracted from the computer-programming implementation details.

OOP is realized much more in Java or C# than it is in C++ as C++ still tends to require a good amount of concentration on the "implementation details".

It is an "abstraction paradigm" -- meaning simply that it is a way that we can look at programming that helps us build programs.

One does not need an Object Oriented language to implement OOP -- however, because OOP has rules and conventions that are much much easier to work with when it is a compiler that enforces things. i.e. you can write OOP in C (in fact some C++ compilers actually compile the program down to C rather than assembly or machine language), but you have to enforce all of the conventions yourself. Since this is a little tiresome (and humans always want to cheat) one generally uses an OOP language rather than trying to do it by hand. (I used to use some very pseudo-OOP programming conventions in QBasic because it made my programs easier to develop).