Re: [gtk-list] OFF-TOPIC (was Re: gtk-- vs. vdk)
- From: George <jirka 5z com>
- To: gtk-list redhat com
- Subject: Re: [gtk-list] OFF-TOPIC (was Re: gtk-- vs. vdk)
- Date: Wed, 14 Oct 1998 03:29:14 -0700
On Tue, Oct 13, 1998 at 08:30:55AM +0200, Guillaume Laurent wrote:
> Sorry, I react to this like a Pavlov dog I guess, but I think it's
> worth at least not to let things like that pass undisputed.
ok I'll bite :)
> George <jirka@5z.com> writes:
> > however ... given the experience I've had with C++ I'd recommend against
> > switching ...
>
> Would you care to explain more in details why ?
very simple ... C++ does a lot of things, and that's it's failiure ...
I did a large project in borland owl .. and I can tell you it's one of
the worst, crappiest pieces of code I've ever done ... most of it is
stemming from the fact that in the C++ mentality, you tend to "derive"
an object when there is no need to derive an object ... to create
a dialog box in owl takes me quite a lot longer then to create a dialog
with gtk and C ...
yes .. it is harder to create objects in C ... but if you use an object
model such as gtk's ... you can do things that you can't do with C++'s
unless you add your own code for it ...
for example
1) you can attach arbitrary data to arbitrary objects
2) you can use refcounting out of the box
3) you can redefine methods of an object_class in runtime
4) the objects support a notion of signals
most of the time I spent creating objects, both in C or in C++ was to
copy an existing object, do a couple of search and replaces and voila,
I got a new object ... so for me the time spent is almost the same
I however spent way more time typing code when I was doing C++ then when
I'm doing C ...
also C is much more straightforward to think about ... it's much easier
to think in terms of C then in terms of something more complicated, C++
tries to do a lot of "magic" ... stuff that it hides from the programmer
... this is actually bad ... magic is hardly ever predictable ...
I think OO has been WAAAY overhyped ... OO should be used for some parts
of a program, but other parts can easily be standard non-OO programming
without loosing any "maintainability" for "reusability" of the code ...
another problem with C++ that I have, is that just about any library
written using it ... is very heavy weight ... just compare STL to glib
... and I find glib much more usefull ... and it's also very light weight
and very predictable .. and I like my libraries predictable ...
let's take it feature by feature:
classes: can be simulated in C with more features or can be simulated
in a much lighter weight manner
templates: don't get me started, though it is something that might
appear somewhat usefull, until you relize that you can work
around it in C with things like void pointers, which C++
programmers seem to hate
namespaces: all it does is eat up resources during compilation, and can
be easily avoided by using what say gtk uses ... a prefix to
non-static functions, if you work on a large monolithic beast of
a program that almost requires namespaces, there is something
wrong with your design in the first place
multiple inheritance: a useless feature which puts waaay to much
preassure on the compiler, and makes dynamic linking such
a pleasure to do
also there is this C++ mentality that everything should be derived ...
such mentality that would derive a driver from a car and a person ...
instead of doing it the OO way, adding a car to a person object,
preferably at runtime ...
> > how about Objective C if you want to use a C with objective syntax
> > .. (there are gtk/gnome bindings of course)
>
> ... Consider also that Objective C is about as dead as a language can
> be.
hmmm same sort of mentality would have forced me to use windows ...
why would the fact that very few programmers use it, make the language
any worse ... it's got an actively maintained compiler ... I have
absolutely no problem using it ... plust I know quite a lot of people
who like objc .. and code in it regularly
> Sorry for the off-topic answer, but this kind of statement really
> annoys me. C++ has flaws, but certainly does not deserve to be put
> aside like this. I agree that Objective C is much nicer to use,
> though, and that a language can't get much more complex than C++.
so why not use a langage that's nicer to use ... I don't see any
advantage in using what the "masses" use ... I see an advantage however
using a language I'm comfortable with
> But C++ is also extremely powerful, and most of its "bad reputation"
> is very unfounded, because of which many talented people stick to C
> and go through hoops to do what C++ would let them do ten times more
> easily.
I tried C++ ... and a year ago ... I'd tell you how great it is ...
then I did a mistake of using it for a very large project ...
but then again .. I may just be non-talented and so I do work faster
in C
> Starting a new project in C today (now that we have a very good C++
> compiler - egcs, not 2.8.0), even moderately large, is more often than
> not a mistake that results in a huge waste of time and resources.
I'd say the exact opposite, based on personal experience ... none of my
C projects got out off hand where they would be impossible to manage or
change .... however both large C++ projects I worked on ... got so badly
out of hand that i's just rediculous ...
to show an example ... I wrote a proper C++ program and it took me a
week or so to to get the kinks out ... and it was quite a lot of code
(this was using STL) ... I wrote a much faster and nicer program in
less time with C and glib ... the two programs do exactly the same thing
however one is faster and takes WAAAY less memory to run ... and one
is larger and slower ... also one of them took me a week .. the other
one took me a weekend ... plus I can master C in much less time then
it takes me to master C++ ...
George
--
------------------------------------------------------------------------------
George Lebl <jirka@5z.com> http://www.5z.com/jirka/
------------------------------------------------------------------------------
The following implements RSA in perl and is illegal to export from the US:
#!/bin/perl -sp0777i<X+d*lMLa^*lN%0]dsXx++lMlN/dsM0<j]dsj
$/=unpack('H*',$_);$_=`echo 16dio\U$k"SK$/SM$n\EsN0p[lN*1
lK[d2%Sa2/d0$^Ixp"|dc`;s/\W//g;$_=pack('H*',/((..)*)$/)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]