“I understand there are several different philosophies of application development. Some people prefer GTK not because it is the better tool kit, but because the approach makes more sense to them, because GTK is more granular than Qt, prefer C to C++, or another reason. I cannot address all of these factors, but I will try to take them into account wherever they matter.” Part I and Part II at LinuxWorld.
If you ask me Gnome/GTK _far_ superseeds KDE. Qt and the KDE UI classes are great though, but the KDE IOSlaves seems like a bad joke compared to Gnome-VFS. The same goes
for KParts/DCOP vs Bonobo.
For users KDE is probably the best right now though. Gnome
have to many bugs and usability problems at the moment.
For programmers its also a prefrence of C vs C++, but those that says that you cant do object orientation in C are simply wrong, or atleast got the wrong idea of what object orientation is…
To say that someone is incorrect when they claim that C cannot be used to do object oriented programming just truly shows how uneducated you really are. To be a “true” object oriented language it needs to be build from the ground up to utilize it’s internal class structure. Otherwise, you are just pretending… sort of like using an emulator. Do you use VmWare too?
Let’s not get too vitriolic here. It is certainly possible to coerce C into something of an object oriented language. And this should be obvious: the first versions of C++, after all, were nothing more than translators generating C code.
For a more detailed account of how common object oriented idioms can be expressed using C, consult this paper: http://www.accu.org/acornsig/public/articles/oop_c.html . This is not the only way, of course, but it should give you an idea of how it can be done. For an example of object oriented C programming, you really ought to browse through GhostScript’s source.
Perhaps you should educate yourself before lashing out so violently, sir!
To be a “true” object oriented language it needs to be build from the ground up to utilize it’s internal class structure. Otherwise, you are just pretending… sort of like using an emulator.
This statement has no meaning. Could you explain yourself? The central tenet of object oriented programming is the encapsulation of data and methods on that data into a coherent package. All of this rhetoric about “true” object orientation is, well, just that.
and while we’re at it vi is better than emacs…
>For a more detailed account of how common object oriented >idioms can be expressed using C, consult this paper: >http://www.accu.org/acornsig/public/articles/oop_c.html .
That paper shows Object Based. Not Object Orientated.
See the “Object Orientation FAQ” at “What Is The Difference Between Object-Based And Object-Oriented?”.
IF OO can be archivied in C it will look ugly as hell compared to an OO language. The only OO written software I have seen written in C must be Gtk ( It may not be totally OO (I really don’t remember)).
Quoted from the paper:
“If you are interested in object-oriented programming I would suggest playing with a real object-oriented language such as Smalltalk “
>The central tenet of object oriented programming is the >encapsulation of data and methods on that data into a >coherent package. All of this rhetoric about “true” object >orientation is, well, just that.
You desribed Object Based programming.
You forgot “Inheritance”.
“To say that someone is incorrect when they claim that C cannot be used to do object oriented programming just truly shows how uneducated you really are.”
You really should educate yourself before you claim other people are uneducated.
It is fully possible to do object oriented programming in C. It’s a major pain in the ass and an exercise in frustration, but it is possible. I’ve read articles on how to do it in Dr. Dobbs, although I have never actually tried it.
If you are interested in object-oriented programming I would suggest playing with a real object-oriented language such as Smalltalk
As would I. I’m by no means making a case for C’s being a viable object oriented language, and, obviously, a language such as Smalltalk is vastly superior in expressing the paradigm (yeeech, I sound like some kind of buzzword-hurling project manager here).
This whole C vs. C++ discussion surrounding KDE and GNOME has been beaten to death already. Why rehash this tiresome crap here when it has already been discussed a thousand times before in other forums? The implementation language is irrelevent anyway, since both toolkits are roughly equivalent in power (my apologies to the zealots on both sides, but it’s true). Besides, there are at least two GNOME C++ bindings available that I’m aware of, so it’s something of a moot point to begin with.
Simple solution to a simple problem. Everyone knows that real programmers use Objective C.
Go GnuSTEP!
When you can do true inheritance and polymorphism in C, then let me know. Maybe you can reproduce some OO in C, but you can also drive a car with your feet, but that doesn’t make it a good idea.
If OO is what your after, then C is not the language to choose.
-G
“I invented the term Object-Oriented, and I can tell you I did not have C++ in mind.” — Alan Kay
After actually reading the both articles plus this little piece http://www.linuxworld.com/site-stories/2002/0220.mono.html more or less proofs that Nicholas Petreley is no more than a whiny little brat who has no clue what he is talking about nor what software and programming really is.
For instance, for no apparent reason, he speak derogative about Prolog claiming it is a language for insane people. Call me insane but I actually like Prolog. He also makes personal attacks on Miguel de Icaza and claims that gmc was “almost as buggy as Windows”. Both statements are unsubstantiated. And to quote him;
“You see, Miguel seems to think that the point of Mono (and therefore .Net) is to provide programmers with the joyous experience of being able to write LOGO code that can call a dBase III function, which in turn, calls a GWBASIC function.”
Why indeed would some want to do that? Only isance people would want to do that. Since I am insane I have found such features infinately useable even when using such limited technologies as COM.
I don’t know what kind crap is allowed to be called articles now a days but to me it looks more like he is a troll more than anything else.
I’ve done inheritance and polymorphism in C plenty times before (e.g. my OS’s file system drivers) — giving each ‘class’ its own virtual method table goes a long way to implementing these things.
Remember that the first C++ ‘compilers’ (e.g. CFront) just translated C++ to C and used a normal C compiler. And O-O programming in assembly language is possible, although not pretty; it’s all the same in machine code, regardless of what HLL you use to begin with.
KDE IOSlaves seems like a bad joke compared to Gnome-VFS. The same goes
for KParts/DCOP vs Bonobo.
KParts is a very simple component architecture, not as complex as CORBA. There is some good and some bad. The good is that they don’t have to face complexities because of features they don’t need. The bad is that KPart won’t be able to compete feature wise with CORBA, and those applications that really push CORBA to the limits can use Bonobo, but not KPart, because after all, Bonobo is GNOME’s version of CORBA.
KIO Slaves wise, it is stupid to say it is bad in comparison with VFS. VFS is hardly used by apps outside the core-GNOME team because it inmaturity. I know of many GTK+ programmers that prefer KIO slaves over VFS because KIO slaves vs. VFS is like CORBA vs. KPart.
Simple solution to a simple problem. Everyone knows that real programmers use Objective C.
Go GnuSTEP!
GnuStep is really good. But what they are doing is building an implementation of OpenStep Cocoa, when there is a newer version. They should build a full version of Cocoa with a lot of their own extensions so in the future, Cocoa apps from Mac OS X could be easily ported to Linux.
But for me, I prefer C++. Personal preferences. To me, Obj. C feels like an simplified language for 5 year olds, no offence. Obj. C can do a lot of things Standard C++ or ANSI C can’t do, but C++ and C can do a lot of things better than Obj. C.
If OO is what your after, then C is not the language to choose.
Actually, if you are a C programmer going after OO, GTK+ is quite good. GTK+ 2 is really good, but has a lot of stablity issues =P. Besides, didn’t you heard? C++ is based on C. So, in an ironical way, things like GTK+ can be placed in the same level as C++ 🙂
But anyway, Miguel admited in some .Net/Mono interview that Evolution development could be much more faster if they used a real OO language like C#… :-D.
But the fact remains that C++ was used in the world’s most advance OS – BeOS (no one can say it wasn’t advance, it had bad marketing and well ahead of it’s time)
Oh dammit, lets just build an desktop enviroment based on C# or Smalltalk, and have a flamefest! 🙂
“When you can do true inheritance and polymorphism in C, then let me know. Maybe you can reproduce some OO in C, but you can also drive a car with your feet, but that doesn’t make it a good idea.”
You can do true inheritance and polymorphism in C. Granted it requires writing some extremely complicated function libraries (that is why I said it is a major pain in the ass), but it can be done.
The issue is not that you would want to do it. No sane person would. The issue is that the claim that OOP can’t be done in C is just not correct. It can be done in C, with great difficulty of course.
As others have pointed out, c-front (the first C++ compiler) was really nothing more than a preprocessor that created C code out of C++ code and then compiled the C code.
Pleas go download GTK+, and try, it has inheritance,
virtual methods et.c. Creating you own subclass is really
easy…
GnuStep is really good. But what they are doing is building an implementation of OpenStep Cocoa, when there is a newer version. They should build a full version of Cocoa with a lot of their own extensions so in the future, Cocoa apps from Mac OS X could be easily ported to Linux.
I think GNUStep makes the mistake of trying to comply with a proprietary standard. The GS guys should start from the defined NeXT standard, and then evolve it by themselves. No need to bother copying OS X Cocoa, because for all we know in a year Apple will close the specification back up. Better for them to use OpenStep as inspiration and then develop it themselves – just like Linux evolved from proprietary unixes.
But for me, I prefer C++. Personal preferences. To me, Obj. C feels like an simplified language for 5 year olds, no offence. Obj. C can do a lot of things Standard C++ or ANSI C can’t do, but C++ and C can do a lot of things better than Obj. C.
My favorite language if Python, precisely because it’s so simple. Now, I’m not a serious programmer, and of course I wouldn’t even use Python for a terminal (or anything bigger). But complex does not automatically mean good.
Maybe right now Objective C hasn’t been developed enough to do everything C++ can. But with enough public support it could be, and more importantly, a goal of GS is to make a compiler that can compile a single file containing both C++ and Objective C code. Best of both worlds.
“My favorite language if Python, precisely because it’s so simple. Now, I’m not a serious programmer, and of course I wouldn’t even use Python for a terminal (or anything bigger). But complex does not automatically mean good.”
Python is a good language, even for larger projects. I often use Python to prototype major projects so that I can get the algorithms down and such. Once I have everything working, I then rewrite it in Java or C++. As far as Objective C, I’ve never messed with it, so I can’t comment.
This whole argument is sillier than the programming in KDE vs. GNOME one(1) from the article. As someone pointed out, OOP is more than just combining data and methods. And of course, a C library (i.e., GTK+) could use object oriented techniques; in the invaluable _Design Patterns_ by Gamma et al, it even notes that in languages that do not support OOP directly, OOP could be a useful design pattern. It is irrelevant, however, that C++ was originally implemented as a preprocessor. That’s kind of the point of the C++ folks; would you rather have a machine handle the details or do it yourself?
One of the biggest criticisms of C++ is the performance hit that can result from too many layers of redirection, virtual function calls that can’t be resolved at compile time, etc. Depending on the problem set, that can be a valid concern. Of course, inappropriate use of such features is no more an intrinsic part of C++ than using an uninitialized pointer is of C. An interesting but purely academic question is what would GTK+ have looked like if it had been implemented in C++ as a “better C than C” (e.g., stronger type checking, inline functions) with a subset of C++’s class features (e.g., constructors/destructors, but not multiple inheritance).
(1) For those who haven’t read the article, it’s a little more focused than comments imply. Peterley’s argument is that QT/KDE’s higher level API allows more flexible and consistent apps to be written more easily. GTK+ et al allow fine granularity of control, but GNOME would benefit from an additional, higher level abstraction. I tend to agree, but don’t care to argue, because I don’t use either.
One of the biggest criticisms of C++ is the performance hit that can result from too many layers of redirection, virtual function calls that can’t be resolved at compile time, etc………………………..
This critism comes from the GNU/Linux camp. It isn’t the fault of C++, but it is the fault of the object linking libraries. OOP C++ can be even faster than pseudo-OOP C…. 🙂
I think GNUStep makes the mistake of trying to comply with a proprietary standard. The GS guys should start from the defined NeXT standard, and then evolve it by themselves. No need to bother copying OS X Cocoa, because for all we know in a year Apple will close the specification back up. Better for them to use OpenStep as inspiration and then develop it themselves – just like Linux evolved from proprietary unixes.
Yup, I think it is a bad idea to just implement something else that is propeitary. They should extend it to the dirrection they want…
(Besides, IIRC, Linux was an implementation of Minix not because Minix wasn’t free, but because Linus wanted to learn it…)
Python is a good language, even for larger projects. I often use Python to prototype major projects so that I can get the algorithms down and such. Once I have everything working, I then rewrite it in Java or C++. As far as Objective C, I’ve never messed with it, so I can’t comment.
You aren’t alone there. I took a day to learn Python, BTW. Besides, complex apps can be built using Python. That Portage for example….
You don’t learn Python. You just start using it.
“You aren’t alone there. I took a day to learn Python, BTW. Besides, complex apps can be built using Python. That Portage for example….”
Yep, often times I will prototype a complex app in Python with the intention of rewriting it in C or C++ once I have the algorithms all figured out. However, many times, I find that the Python app performs so well that I end up putting it into production and never rewriting it. With today’s superfast systems, I often find that my time is worth far more than the small amount of performance lost from using Python instead of C++.
>>> Remember that the first C++ ‘compilers’
So let’s step backward in time and recreate the wheel every time we want to use OO. Makes no sense.
-G