Noah Silva on Wed, 10 Jul 2002 00:08:30 -0400 |
> > There's nothing stopping you from using printf in a C++ program. It's a > function call and is perfectly valid. IMHO, the intent of C++ was exactly not > to throw away C, but to add OO concepts. Also, the words are "support > object-oriented programming", not REQUIRE it. When you write C++ code, you > often can and do need to call functions with C-style syntax. This is > perfectly valid, acceptable, and common practice in many of the most OO > development groups. C-style functions are NOT BAD. They just might not be AS > GOOD, or as readable in a true OO app. Well I agree.. I certainly don't do everything object oriented in pascal, believe me. To make something OOP just for the point of making it OOP makes it also a waste of time in my opinion. Like I would make an object with only one method where a procedure will do? not likely. The same thing applies to most procedural type languages I would think. > A well written C program is usually a perfectly valid C++ program. I can only > guess that your teacher was probably trying to get across the concepts of > writing OOP programs versus procedural programs. No this wasn't it, it was supposedly some conflicts in the libraries or inconsistent behaviors. Perhaps it was our particular compiler (code warrior), or perhaps he wanted to have us pulling in fewer libraries. > Here's an example: If you have a "C" function that does exactly what you need, > you don't need to create an object that simply calls that function. However, > if creating an object, or moving the function call to an already existing > object, simplifies much of the rest of your code, then do it. IMHO, the > biggest gains still to be realized from OOP is code readability. I find the advantages to OOP are readability, but also abstraction and the ability to easily duplicate things (i.e. a Window Object that I can make 30 of, instead of some static array of 30 OS window pointers). In pascal, the abstraction can be gotten without OOP by using Units and only interfacing part of them. Actually one thing I really like about pascal is its library ("unit") system and the way the modular compilation works. C seems to me to just be a big sloppy mess next to that. On the other hand, I am sure a C programmer would complain about having to declare everything that is to be exported from the unit. Maybe there ware ways to do similar things in C that I am not aware of (certainly compiling into separate .so or .dll libraries would work!) > <snip> > > And, you seem to be trying to indicate that Java stems very closely from > ObjectPascal and is simply similar to C++ in some elements. I believe that > you have that entirely backwards. No I wouldn't try to say "Java stems very closely from ObjectPascal" - just that a lot of "new" ideas (for C programmers anyhow) were lifted from OP. -- noah silva ______________________________________________________________________ Philadelphia Linux Users Group - http://www.phillylinux.org Announcements-http://lists.phillylinux.org/mail/listinfo/plug-announce General Discussion - http://lists.phillylinux.org/mail/listinfo/plug
|
|