|
|
|
#1 |
|
Messages: n/a
Hébergeur: |
Hello all,
I would like to bring to your attention a concept and a term for it that I think is long overdue. But first: In the bad old days of programming, before subroutines were even available, people used to write "spaghetti code", which was an unreadable, unmaintainable mess of "goto" statements. With the increased availability of more languages such as Pascal and C, and the focus in programming courses on the importance of modularity and abstract data types, one might have thought that the days of commonplace incomprehensible code were over, or at least that the worst case scenario in average code was improved. In the case of C++, this is not so. C++, with its multiple inheritance, templates, and vastly bloated class libraries such as STL and Boost, which permit and seem even to require illegible coding practices in which 5-deep derived classes are not unlikely, has led to the C++ equivalent of spaghetti code. But how to describe it? Commonly people simply call it "bad coding practices" but this is too general. It's like calling a traffic accident "bad driving practices". What then is the term for an "accident" in C++? To describe this build-up of tangled incomprehensible bloat, I shall propose a new term: C++ plaque. It is similar to the plaque build-up in Alzheimer's insofar as it impairs memory, makes the programmer confused about what is located where and what day it is. In addition, when C++ plaque accumulates, it decreases the programmer's ability to function in his/her daily work life, ergo anything (s)he produces will be much more likely to crash, e.g. KDE. Fight code pollution by not polluting. C++ plaque: The cure is within you. Thank you for your attention. |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
Campy Happer <campyhapper@yahoo.com> writes:
> Hello all, > > I would like to bring to your attention a concept > and a term for it that I think is long overdue. [snip] I would like to bring to your attention the fact that C and C++ are two different languages. This may be appropriate in comp.lang.c++; it's not appropriate in comp.lang.c or gnu.misc.discuss. Please restrict any followups to comp.lang.c++. (I doubt that this will do any good, but it's worth a try.) -- Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst> Nokia "We must do something. This is something. Therefore, we must do this." -- Antony Jay and Jonathan Lynn, "Yes Minister" |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
Campy Happer wrote:
> In the case of C++, this is not so. > C++, with its multiple inheritance, > templates, and vastly bloated class libraries > such as STL and Boost, which permit and > seem even to require illegible coding practices > in which 5-deep derived classes are not > unlikely, has led to the C++ equivalent > of spaghetti code. Go troll somewhere else, Linus Torvalds. |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
On Tue, 15 Jul 2008 08:03:29 -0700, Campy Happer wrote:
<some nonsense> Can we phuleeeze not feed the troll. <plonk> -- Lionel B |
|
|
|
#5 |
|
Messages: n/a
Hébergeur: |
In article <3ce476c4-3248-4a00-aaf1-a670c07b331e@l42g2000hsc.googlegroups.com>,
Campy Happer <campyhapper@yahoo.com> wrote: .... >I shall propose a new term: > > C++ plaque. > >It is similar to the plaque build-up in >Alzheimer's insofar as it impairs memory, >makes the programmer confused about >what is located where and what day it is. >In addition, when C++ plaque accumulates, >it decreases the programmer's ability >to function in his/her daily work life, ergo >anything (s)he produces will be much more >likely to crash, e.g. KDE. Two comments: 1) I always associated plaque with dental problems, not Alzheimer's. Is the Alzheimer's reference about the same as the dental one? 2) Another term I've used for the problems induced by the OOP paradigm is "ravioli code". This refers to the fact that you've got all these "things" lying around, active all the time, loosely connected, but all clamoring for attention at the same time. And, in order to track down what is happening, you often have to look in lots of different places. I'm getting hungry. Need some Chef Boyardee... |
|
|
|
#6 |
|
Messages: n/a
Hébergeur: |
Campy Happer <campyhapper@yahoo.com> wrote:
.... In the bad old days of programming, >before subroutines were even available, >people used to write "spaghetti code", which >was an unreadable, unmaintainable mess of >"goto" statements. >... >C++, with its multiple inheritance, >templates, and vastly bloated class libraries >such as STL and Boost, which permit and >seem even to require illegible coding practices >in which 5-deep derived classes are not >unlikely, has led to the C++ equivalent >of spaghetti code. > >But how to describe it? In the one and only true way. The object-oriented version of "Spaghetti code" is, of course, "Lasagna code". (Too many layers.) I have used that expression for years, but so far failed to obtain ISO certification for it, or have it included in Webster's dictionary... It goes without saying that any good chef can cook both Spaghetti and Lasagna codes in either C or C++. (If using the later I would recommend inheriting from the Pasta abstract base class.) -- Roberto Waltman [ Please reply to the group, return address is invalid ] |
|
|
|
#7 |
|
Messages: n/a
Hébergeur: |
> Can we phuleeeze not feed the troll. Imagine a troll post and no responses for a week. I think he's gonna explode. |
|
|
|
#8 |
|
Messages: n/a
Hébergeur: |
On Jul 15, 10:24 am, Juha Nieminen <nos...@thanks.invalid> wrote:
> Campy Happer wrote: > > In the case of C++, this is not so. > > C++, with its multiple inheritance, > > templates, and vastly bloated class libraries > > such as STL and Boost, which permit and > > seem even to require illegible coding practices > > in which 5-deep derived classes are not > > unlikely, has led to the C++ equivalent > > of spaghetti code. > > Go troll somewhere else, Linus Torvalds. Does Linus Torvalds not like C++? |
|
|
|
#9 |
|
Messages: n/a
Hébergeur: |
On Jul 17, 7:22am, s0s...@gmail.com wrote:
> On Jul 15, 10:24 am, Juha Nieminen <nos...@thanks.invalid> wrote: > > > Campy Happer wrote: > > > In the case of C++, this is not so. > > > C++, with its multiple inheritance, > > > templates, and vastly bloated class libraries > > > such as STL and Boost, which permit and > > > seem even to require illegible coding practices > > > in which 5-deep derived classes are not > > > unlikely, has led to the C++ equivalent > > > of spaghetti code. > > > Go troll somewhere else, Linus Torvalds. > > Does Linus Torvalds not like C++? No, he does not :-) |
|
|
|
#10 |
|
Messages: n/a
Hébergeur: |
On Jul 15, 11:16 am, gaze...@xmission.xmission.com (Kenny McCormack)
wrote: > In article <3ce476c4-3248-4a00-aaf1-a670c07b3...@l42g2000hsc.googlegroups.com>, > Campy Happer <campyhap...@yahoo.com> wrote: > ... > > >I shall propose a new term: > > > C++ plaque. > [snip] > 1) I always associated plaque with dental problems, not > Alzheimer's. Is the Alzheimer's reference about the same as > the dental one? Sort of. It refers to the buildup of amyloid plaques (sheets of protein, IIUC) in the brain tissue of Alzheimer's sufferers. I think this is closer to the meaning the OP is going for. |
|
|
|
#11 |
|
Messages: n/a
Hébergeur: |
"John Bode" <jfbode1029@gmail.com> wrote in message
> > Sort of. It refers to the buildup of amyloid plaques (sheets of > protein, IIUC) in the brain tissue of Alzheimer's sufferers. I think > this is closer to the meaning the OP is going for. > If you are interested in computer models of amyloid, see my website. It's the major focus of my work. -- Free games and programming goodies. http://www.personal.leeds.ac.uk/~bgy1mm |
|
|
|
#12 |
|
Messages: n/a
Hébergeur: |
fnegroni wrote:
>> Does Linus Torvalds not like C++? > > No, he does not :-) Well, I know only the comments Linus Torvalds made about the implications of using C++ to develop a kernel. And I totally agree with him in his statements. Programming a kernel you want to control every bit of the program (yes I know, that this sentence can be interpreted in many ways, and each way totaly matches what I mean). A languages like C++, that hides (some) vital aspects of the underlying mechanisms can break things at such a low level application. I'm thinking mainly about the way, polymorphism is implemented (there's no standard about that in current C++), how name mangling is performed (dito), calling conventions if objects are passed by reference (dito). Another problem is, that the use of some C++ features (I'm looking at templates here) will start a chain reaction in which code is created generically w/o having any influence on the exact outcome. This is not the same like using macros to create a similair effect; doing it with a macro one must exactly know what's going on. IMHO C++ was once a fine language, but it took some problematic turns. The existence of tools like "moc" of Qt, a own, not fully standardized interface description language (IDL) to be translated in a set of abstract interface classes and from those derived implementation classes, not to forget gccxml to give the guy who want's some too to process C++ without getting into a lof of trouble are symptoms for this. I dunno, but I got a row of programming language books in my shelf and "The C++ programming language" by Stroustroup is easly the thickest. It even beats "Modern Compiler Design" and goes equal with Volume 2 and 3 of "The Art of Computer Programming". Wolfgang Draxinger -- E-Mail address works, Jabber: hexarith@jabber.org, ICQ: 134682867 |
|
|
|
#13 |
|
Messages: n/a
Hébergeur: |
On Jul 18, 1:31 am, Wolfgang Draxinger <wdraxin...@darkstargames.de>
wrote: > fnegroni wrote: > >> Does Linus Torvalds not like C++? > > No, he does not :-) > Well, I know only the comments Linus Torvalds made about the > implications of using C++ to develop a kernel. And I totally > agree with him in his statements. Programming a kernel you want > to control every bit of the program (yes I know, that this > sentence can be interpreted in many ways, and each way totaly > matches what I mean). C++ only hides what you want it to hide. The old Chorus OS was written entirely in C++, and presumably, significant parts of it have migrated into the current versions of Solaris, which would mean that significant parts of Solaris are written in C++. -- James Kanze (GABI Software) email:james.kanze@gmail.com Conseils en informatique orientée objet/ Beratung in objektorientierter Datenverarbeitung 9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34 |
|
|
|
#14 |
|
Messages: n/a
Hébergeur: |
* James Kanze:
> On Jul 18, 1:31 am, Wolfgang Draxinger <wdraxin...@darkstargames.de> > wrote: >> fnegroni wrote: >>>> Does Linus Torvalds not like C++? > >>> No, he does not :-) > >> Well, I know only the comments Linus Torvalds made about the >> implications of using C++ to develop a kernel. And I totally >> agree with him in his statements. Programming a kernel you want >> to control every bit of the program (yes I know, that this >> sentence can be interpreted in many ways, and each way totaly >> matches what I mean). > > C++ only hides what you want it to hide. The old Chorus OS was > written entirely in C++, and presumably, significant parts of it > have migrated into the current versions of Solaris, which would > mean that significant parts of Solaris are written in C++. It seems to be mostly C. But some C++ files. E.g. http://jaluna.cvs.sourceforge.net/ja....1&view=markup Cheers, - Alf -- A: Because it messes up the order in which people normally read text. Q: Why is it such a bad thing? A: Top-posting. Q: What is the most annoying thing on usenet and in e-mail? |
|
|
|
#15 |
|
Messages: n/a
Hébergeur: |
Wolfgang Draxinger a écrit :
> fnegroni wrote: > >>> Does Linus Torvalds not like C++? >> No, he does not :-) > > Well, I know only the comments Linus Torvalds made about the > implications of using C++ to develop a kernel. And I totally > agree with him in his statements. Programming a kernel you want > to control every bit of the program (yes I know, that this > sentence can be interpreted in many ways, and each way totaly > matches what I mean). I don't know about every bit but some of them I, assuredly do want to. Building an Os does not resume to putting bits to ones and zero, even in Linux. Symbian seems a fine os and eCos also; and their core is written in C++. > A languages like C++, that hides (some) vital aspects of the > underlying mechanisms can break things at such a low level > application. I'm thinking mainly about the way, polymorphism is > implemented (there's no standard about that in current C++), Polymorphism is only one aspect and one you can easily avoid especially for something as simple as a driver. > how > name mangling is performed (dito), Is it that much a problem ? > calling conventions if > objects are passed by reference (dito). Do you mean the semantics are harder to identify ? > Another problem is, that > the use of some C++ features (I'm looking at templates here) > will start a chain reaction in which code is created generically > w/o having any influence on the exact outcome. This is not the > same like using macros to create a similair effect; doing it > with a macro one must exactly know what's going on. You mean people that write templates have no control other the code generated ? Generative programing does not mean you have no control, to the contrary. > IMHO C++ was once a fine language, but it took some problematic > turns. When was it, before the standard (CFront) ? > The existence of tools like "moc" of Qt, How a GUI library come into this ? I don't know if moc is still that much a necessity; IIRC it mainly set some data for signal management and that can nowadays be addressed in pure c++. It also adds some properties (such as class names) that cannot. > a own, not fully > standardized interface description language (IDL) to be > translated in a set of abstract interface classes and from those > derived implementation classes, This is CORBA and if you have ever worked with linux RPC tools, it is the same issue (I would say worse). > not to forget gccxml to give the > guy who want's some too to process C++ without getting into a > lof of trouble are symptoms for this. C++ is harder to parse that is true but I don't see how that relate to code generated. The purpose of gccxml is more to provide an easy parsing facility than run into trouble. > I dunno, but I got a row > of programming language books in my shelf and "The C++ > programming language" by Stroustroup is easly the thickest. It > even beats "Modern Compiler Design" and goes equal with Volume 2 > and 3 of "The Art of Computer Programming". It is a language with more expression features and thus more traps. How does this relate to OS ? -- Michael |
|
|
|
#16 |
|
Messages: n/a
Hébergeur: |
On Jul 18, 9:27 am, Michael DOUBEZ <michael.dou...@free.fr> wrote:
> Wolfgang Draxinger a écrit : > > fnegroni wrote: > Polymorphism is only one aspect and one you can easily avoid > especially for something as simple as a driver. Actually, drivers are, by their very nature, polymorphic, and if you don't use an abstract base class and derive from it, you have to implement by hand what the compiler does. [...] > > IMHO C++ was once a fine language, but it took some problematic > > turns. > When was it, before the standard (CFront) ? Back in the good ole days (which, of course, weren't so good when we were actually living them). For the rest, of course, there are places in an OS kernel where you would want to restrict the use of certain C++ features---an exception which tries to propagate back through your context switch routine isn't likely to work very well. But off hand, exceptions are about the only C++ feature I see which would cause problems (and then only in specific contexts---which represent less than 10% of the OS). And C++ gives you a lot more safety than C, even when used as a "better C". I can see a lot of OS's sticking with C because that's what they were originally written in, and they're not undergoing active enough evolution to warrent porting to C++, but other than that, it would be foolish and irresponsible not to take advantages of the extra safety C++ provides. -- James Kanze (GABI Software) email:james.kanze@gmail.com Conseils en informatique orientée objet/ Beratung in objektorientierter Datenverarbeitung 9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34 |
|
|
|
#17 |
|
Messages: n/a
Hébergeur: |
Wolfgang Draxinger wrote:
> fnegroni wrote: > >>> Does Linus Torvalds not like C++? >> No, he does not :-) > > Well, I know only the comments Linus Torvalds made about the > implications of using C++ to develop a kernel. And I totally > agree with him in his statements. His statements are not limited to the Linux kernel, and they are completely irrational at times. For example, he states that C++ leads to bad programming practices because of all the "high level stuff" (such as abstraction, data hiding, etc), while C leads to good programming practices precisely because it's so low-level. He also states that programming in the C++ way leads to inefficient code, while programming in C leads automatically to efficient code. Anyone who even considers using things like std::string don't understand anything about efficiency and low-level issues. I have actually written an open letter to him about a really shameful flamewar he participated in, regarding this subject. http://warp.povusers.org/OpenLetters...oTorvalds.html |
|
|
|
#18 |
|
Messages: n/a
Hébergeur: |
On Jul 18, 11:24pm, Tim Smith <reply_in_gr...@mouse-potato.com>
wrote: > In article <4c15l5-fk5....@darkstargames.dnsalias.net>, > Wolfgang Draxinger <wdraxin...@darkstargames.de> wrote: > > > > > > > Well, I know only the comments Linus Torvalds made about the > > implications of using C++ to develop a kernel. And I totally > > agree with him in his statements. Programming a kernel you want > > to control every bit of the program (yes I know, that this > > sentence can be interpreted in many ways, and each way totaly > > matches what I mean). > > > A languages like C++, that hides (some) vital aspects of the > > underlying mechanisms can break things at such a low level > > application. I'm thinking mainly about the way, polymorphism is > > implemented (there's no standard about that in current C++), how > > name mangling is performed (dito), calling conventions if > > objects are passed by reference (dito). Another problem is, that > > the use of some C++ features (I'm looking at templates here) > > will start a chain reaction in which code is created generically > > w/o having any influence on the exact outcome. This is not the > > same like using macros to create a similair effect; doing it > > with a macro one must exactly know what's going on. > > I have yet to encounter a C++ compiler that will refuse to compile a > program if it does not use polymorphism, passing objects by reference, > and templates. There is nothing forcing someone who writes a kernel in > C++ to do those (possibly) questionable things. > > -- you can call it C++ code but without them you are just codding in C and the trouble is that many high level featuers do not always suit to kernel programming ,on the other hand C++ is not high level enough for some tasks such as web programming,multithreading ... In short words today`s C++ cannot be considered as general purpose as C used to be in good old days. Q:Is there any alternative?(I mean a true ** modern general purpose flexible** language with **suitable for mixed-level programming**)? regards, FM. |
|
|
|
#19 |
|
Messages: n/a
Hébergeur: |
terminator wrote:
> Q:Is there any alternative?(I mean a true ** modern general purpose > flexible** language with **suitable for mixed-level programming**)? If I'm not mistaken Ada was intended to be one, but it never got widely popular. |
|
|
|
#20 |
|
Messages: n/a
Hébergeur: |
On Jul 19, 11:25 am, terminator <farid.mehr...@gmail.com> wrote:
> On Jul 18, 11:24 pm, Tim Smith <reply_in_gr...@mouse-potato.com> > wrote: > > In article <4c15l5-fk5....@darkstargames.dnsalias.net>, > > Wolfgang Draxinger <wdraxin...@darkstargames.de> wrote: > > > Well, I know only the comments Linus Torvalds made about the > > > implications of using C++ to develop a kernel. And I totally > > > agree with him in his statements. Programming a kernel you want > > > to control every bit of the program (yes I know, that this > > > sentence can be interpreted in many ways, and each way totaly > > > matches what I mean). > > > A languages like C++, that hides (some) vital aspects of the > > > underlying mechanisms can break things at such a low level > > > application. I'm thinking mainly about the way, polymorphism is > > > implemented (there's no standard about that in current C++), how > > > name mangling is performed (dito), calling conventions if > > > objects are passed by reference (dito). Another problem is, that > > > the use of some C++ features (I'm looking at templates here) > > > will start a chain reaction in which code is created generically > > > w/o having any influence on the exact outcome. This is not the > > > same like using macros to create a similair effect; doing it > > > with a macro one must exactly know what's going on. > > I have yet to encounter a C++ compiler that will refuse to compile a > > program if it does not use polymorphism, passing objects by reference, > > and templates. There is nothing forcing someone who writes a kernel in > > C++ to do those (possibly) questionable things. Anyone who codes a kernel without using polymorphism just has to reimplement it by hand. Ditto passing objects by reference. And I fail to see any problem with templates, although given that most of the data structures in a kernel are very customized, they'll probably be used less than in the intermediate layers. > you can call it C++ code but without them you are just codding in C > and the trouble is that many high level featuers do not always suit to > kernel programming, Some (like exceptions) don't, but most do. > on the other hand C++ is not high level enough for > some tasks such as web programming,multithreading ... Funny, I use it for that, with no problem. (Well, I'm not sure what you consider web programming, but Firefox is written mainly in C++. But maybe you don't consider that web programming.) > In short words today`s C++ cannot be considered as general > purpose as C used to be in good old days. C was never really a good general purpose language. It was never used (nor even usable) in commercial software, for example. -- James Kanze (GABI Software) email:james.kanze@gmail.com Conseils en informatique orientée objet/ Beratung in objektorientierter Datenverarbeitung 9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34 |
|
|
|
#21 |
|
Messages: n/a
Hébergeur: |
* James Kanze:
> > C was never really a good general purpose language. It was > never used (nor even usable) in commercial software, for > example. I'm not sure that statement is valid. It would be very surprising, to say the least, if no or just a very few commercial applications were written in C. A quick Google search did not, however, me find commercial software written in any specific language (yes, I'm aware of Bjarne's old list for C++). Cheers, - Alf -- A: Because it messes up the order in which people normally read text. Q: Why is it such a bad thing? A: Top-posting. Q: What is the most annoying thing on usenet and in e-mail? |
|
|
|
#22 |
|
Messages: n/a
Hébergeur: |
* Alf P. Steinbach:
> * James Kanze: >> >> C was never really a good general purpose language. It was >> never used (nor even usable) in commercial software, for >> example. > > I'm not sure that statement is valid. > > It would be very surprising, to say the least, if no or just a very few > commercial applications were written in C. > > A quick Google search did not, however, me find commercial software > written in any specific language (yes, I'm aware of Bjarne's old list > for C++). Oh, sorry, I've been on a medium large C project for client, this was late 90's, and I think that qualifies as commercial software. It was mainly C, but also some Cobol and SQL and stuff. It was a mess, years over deadline (I don't know how they convinced the client to continue), using a GUI framework the company had developed years back, in C. I recall the project leader being a bit angry with me when I cautioned against trying to sell in another project based on same technology. It seems to me that people advance to leadership positions based solely on lack of ethical circuits. Cheers, - Alf -- A: Because it messes up the order in which people normally read text. Q: Why is it such a bad thing? A: Top-posting. Q: What is the most annoying thing on usenet and in e-mail? |
|
|
|
#23 |
|
Messages: n/a
Hébergeur: |
James Kanze wrote, On 20/07/08 09:23:
> On Jul 19, 11:25 am, terminator <farid.mehr...@gmail.com> wrote: <snip> >> In short words today`s C++ cannot be considered as general >> purpose as C used to be in good old days. > > C was never really a good general purpose language. It was > never used (nor even usable) in commercial software, for > example. The company I currently work for was initially built on selling SW written in C to large UK corporations. We still do a lot of business with that old SW which is still mostly written in C. -- Flash Gordon |
|
|
|
#24 |
|
Messages: n/a
Hébergeur: |
On 20 Jul., 10:23, James Kanze <james.ka...@gmail.com> wrote:
> On Jul 19, 11:25 am, terminator <farid.mehr...@gmail.com> wrote: > > C was never really a good general purpose language. It was > never used (nor even usable) in commercial software, for > example. This is not correct. My guess would be that there is loads of C-based software around. Speaking for myself, I have been developing commercial software in C from the days before C++ became popular. The software was a financial package which is still today very successfull. I was one of the programmers evaluating C++ as a replacement and even though I liked it very much, I had to reject it: we programmed for a segmented architecture (yes - it was so long ago!), and the current C+ + compilers we found did not have sufficiently good support for that. Had the compiler given us suficient support for the architecture, I would certainly have recommended C++. Also many of the database-products out there (e.g. Oracle) are written mostly or entirely in C. /Peter |
|
|
|
#25 |
|
Messages: n/a
Hébergeur: |
James Kanze said:
<snip> > C was never really a good general purpose language. It was > never used (nor even usable) in commercial software, for > example. So MS Windows is not commercial software? Interesting. (Early versions of MS Windows were written almost entirely in C.) -- Richard Heathfield <http://www.cpax.org.uk> Email: -http://www. +rjh@ Google users: <http://www.cpax.org.uk/prg/writings/googly.php> "Usenet is a strange place" - dmr 29 July 1999 |
|
![]() |
| Outils de la discussion | |
|