Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 why is object oriented programming better?
Index -> Programming, C++ -> C++ Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Fonzie




PostPosted: Sun Sep 11, 2005 4:06 pm   Post subject: why is object oriented programming better?

I'm doing an essay on the history of c and c++, and I can't seem to understand what, exactly, is the difference between object oriented programming, and whatever it was that c used. Why is OOP better than the structured thing c used?
Sponsor
Sponsor
Sponsor
sponsor
[Gandalf]




PostPosted: Sun Sep 11, 2005 4:26 pm   Post subject: (No subject)

Yes, please tell us! Smile

I think it has something to do with when they came out with the GUI, object oriented programming became more neccessary since each window, etc would be it's own 'object'. Something like that.
Hikaru79




PostPosted: Sun Sep 11, 2005 4:50 pm   Post subject: (No subject)

When you say "better" I'm going to assume you mean better than procedural programming. The answer is, it is better in many many different ways.

First of all, it allows easy code re-use. If I write, for example, a conf file parser as an object, I can use that in all other programs I write that could use one. That's harder in procedural code, because it tends to get all spread out all over the place.

Second of all, it requires you to write less, and more maintainable, code. If you have a class hierarchy, you can implement something in a top-level class and all the other subclasses will inherit that -- more importantly, if you want to CHANGE something, you change it in one place instead of in fifty.

Third of all, it is a further level of abstraction that is just plain closer to the way humans think. Take pool for example. We don't view pool as a sequential flow of events, like an algorithm -- we view it as a table with balls that interact with each other in specified ways. It is much, MUCH, easier to write a large program in OOP than in anything else. If you don't think it does, OOP hasn't really "clicked" for you yet, then.

Fourth of all, there's a million more reasons. It allows access modifiers to prevent programmer mistakes, it introduces the concept of programming interfaces to make it easy to write modular programs, it is just a great paradigm. There's a reason why so many modern languages pay it at least lip service.

And I don't think it has anything to do with GUI's, since some OOP languages predate any really serious, advanced GUI's.

My two cents.
[Gandalf]




PostPosted: Sun Sep 11, 2005 5:26 pm   Post subject: (No subject)

I was just guessing since I read that for Java they have OOP partially for the GUI.

Other than access specifiers, what is the difference (for the better) between structs, 'records', modules, etc. and classes? I see the difference, since you can have objects, each with the properties of the class and their own scope, but the whole 'interaction' thing doesn't click... I think it's because I've never experienced a case where the kind of class-free structured programming isn't sufficient.
Fonzie




PostPosted: Sun Sep 11, 2005 6:19 pm   Post subject: (No subject)

thankya kindly hikaru. if anyone wants to make sure my facts aren't wrong, I'd be much obliged. Here's the essay.


history of c.doc
 Description:

Download
 Filename:  history of c.doc
 Filesize:  22.5 KB
 Downloaded:  150 Time(s)

[Gandalf]




PostPosted: Sun Sep 11, 2005 6:29 pm   Post subject: (No subject)

Looks good. The last sentence:
Quote:
The next step forward will be C#, which will be a language that improves upon C++.

I think I will not be the only one to question the relation of C# to C++, and how it impoves on it. I may be wrong though.
Hikaru79




PostPosted: Sun Sep 11, 2005 7:58 pm   Post subject: (No subject)

I didn't fact-check or anything, but it looks good to me Smile Good luck!
Display posts from previous:   
   Index -> Programming, C++ -> C++ Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 7 Posts ]
Jump to:   


Style:  
Search: