C++ equivalent to spaghetti code

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • terminator

    #16
    Re: C++ equivalent to spaghetti code

    On Jul 18, 11:24 pm, Tim Smith <reply_in_gr... @mouse-potato.com>
    wrote:
    In article <4c15l5-fk5....@darksta rgames.dnsalias .net>,
     Wolfgang Draxinger <wdraxin...@dar kstargames.dewr ote:
    >
    >
    >
    >
    >
    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,mul tithreading ...
    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.

    Comment

    • Juha Nieminen

      #17
      Re: C++ equivalent to spaghetti code

      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.

      Comment

      • James Kanze

        #18
        Re: C++ equivalent to spaghetti code

        On Jul 19, 11:25 am, terminator <farid.mehr...@ gmail.comwrote:
        On Jul 18, 11:24 pm, Tim Smith <reply_in_gr... @mouse-potato.com>
        wrote:
        In article <4c15l5-fk5....@darksta rgames.dnsalias .net>,
        Wolfgang Draxinger <wdraxin...@dar kstargames.dewr ote:
        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,mul tithreading ...
        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.kan ze@gmail.com
        Conseils en informatique orientée objet/
        Beratung in objektorientier ter Datenverarbeitu ng
        9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34

        Comment

        • Flash Gordon

          #19
          Re: C++ equivalent to spaghetti code

          James Kanze wrote, On 20/07/08 09:23:
          On Jul 19, 11:25 am, terminator <farid.mehr...@ gmail.comwrote:
          <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

          Comment

          • Richard Heathfield

            #20
            Re: C++ equivalent to spaghetti code

            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

            Comment

            • peter koch

              #21
              Re: C++ equivalent to spaghetti code

              On 20 Jul., 10:23, James Kanze <james.ka...@gm ail.comwrote:
              On Jul 19, 11:25 am, terminator <farid.mehr...@ gmail.comwrote:
              >
              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

              Comment

              • Richard Heathfield

                #22
                Re: C++ equivalent to spaghetti code

                [followups set to clc]

                peter koch said:

                <snip>
                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.
                Re-post (as far as I'm aware, I first posted this back in 2006):

                An Oracle programmer (a very good one, I hasten to add) once told me of a
                chap who came to his place of work in the early 1990s, attempting to
                persuade them to convert from C to C++. The poor chap spent an hour or so
                presenting an object-oriented database methodology to the Oracle guys. He'd
                obviously worked very hard on it. As he was winding up his presentation and
                heading rapidly towards "are there any questions?", he suddenly noticed
                that just about everybody in the room was regarding him with utter
                astonishment. He panicked, and said "What's the matter? Have I got
                something wrong?" Came the reply, "No, no, maybe one or two bits could be
                improved here or there... it's broadly okay though... but - we did all this
                *years* ago! And you want us to write it *again*?"

                --
                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

                Comment

                • David Kastrup

                  #23
                  Re: C++ equivalent to spaghetti code

                  Richard Heathfield <rjh@see.sig.in validwrites:
                  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.
                  Last time I looked, UNIX was not particularly uncommercial either.

                  --
                  David Kastrup, Kriemhildstr. 15, 44793 Bochum

                  Comment

                  • lawrence.jones@siemens.com

                    #24
                    Re: C++ equivalent to spaghetti code

                    Alf P. Steinbach <alfps@start.no wrote:
                    >
                    It would be very surprising, to say the least, if no or just a very few
                    commercial applications were written in C.
                    All of my company's major commercial applications are written
                    predominantly in C, including one that's completely object oriented
                    but predates C++ by about a decade.
                    --
                    Larry Jones

                    These child psychology books we bought were such a waste of money.
                    -- Calvin's Mom

                    Comment

                    • Lorenzo Villari

                      #25
                      Re: C++ equivalent to spaghetti code


                      "James Kanze" <james.kanze@gm ail.comha scritto nel messaggio
                      news:01af3dcd-4e01-41aa-9f15-90baf313f750@b1 g2000hsg.google groups.com...
                      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.)
                      I'm maybe wrong, but I was under the impression that for Firefox they use
                      gtk+, which is written in C...









                      Comment

                      • James Kanze

                        #26
                        Re: C++ equivalent to spaghetti code

                        On Jul 20, 10:50 am, "Alf P. Steinbach" <al...@start.no wrote:
                        * 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.
                        There are certainly a few. Way back when, however, the X/Open
                        group proposed standardizing a form of Cobol (under Unix!)
                        because C was felt to be unusable for business applications.

                        At least certain types of business applications require some
                        sort of decimal type. If the language doesn't have it built in
                        (as Cobol and PL-1 did), and it doesn't have operator
                        overloading, expressions quickly become unreadable. For those
                        applications, at least, if the language doesn't have a built-in
                        decimal type, and it doesn't have operator overloading, then
                        it's really unusable for those applications (although you'll
                        doubtlessly find some masocists doing it).

                        --
                        James Kanze (GABI Software) email:james.kan ze@gmail.com
                        Conseils en informatique orientée objet/
                        Beratung in objektorientier ter Datenverarbeitu ng
                        9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34

                        Comment

                        • Sherman Pendley

                          #27
                          Re: C++ equivalent to spaghetti code

                          "Lorenzo Villari" <vlllnz@alice.i twrites:
                          I'm maybe wrong, but I was under the impression that for Firefox they use
                          gtk+, which is written in C...
                          Gtk+ is indeed written in C, but it's object-oriented and has bindings
                          for a number of languages, including C++.

                          sherm--

                          --
                          My blog: http://shermspace.blogspot.com
                          Cocoa programming in Perl: http://camelbones.sourceforge.net

                          Comment

                          • James Kanze

                            #28
                            Re: C++ equivalent to spaghetti code

                            On Jul 20, 1:51 pm, Richard Heathfield <r...@see.sig.i nvalidwrote:
                            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.
                            Yes. Commercial can be used in several senses (and I'm not sure
                            of the usual English usage here). There's a lot of software
                            written in C that is commercial in the sense that it is sold
                            (i.e. commercial as opposed to free software). What I was
                            talking about, however, was the application domain. You can't
                            really do accounting in C, for example, because it has neither a
                            built in decimal type (like Cobol), nor operator overloading on
                            user defined types (like C++). More generally, C is pretty bad
                            for text handling as well.

                            Of course, a lot of early Unix systems only had C, and between C
                            and assembler, you used C, even if it wasn't the ideal language
                            for the job. (Although the old X/Open group did try to
                            standardize a Cobol dialect for Unix.)

                            --
                            James Kanze (GABI Software) email:james.kan ze@gmail.com
                            Conseils en informatique orientée objet/
                            Beratung in objektorientier ter Datenverarbeitu ng
                            9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34

                            Comment

                            • Willem

                              #29
                              Re: C++ equivalent to spaghetti code

                              James Kanze wrote:
                              ) Yes. Commercial can be used in several senses (and I'm not sure
                              ) of the usual English usage here). There's a lot of software
                              ) written in C that is commercial in the sense that it is sold
                              ) (i.e. commercial as opposed to free software). What I was
                              ) talking about, however, was the application domain. You can't
                              ) really do accounting in C, for example, because it has neither a
                              ) built in decimal type (like Cobol), nor operator overloading on
                              ) user defined types (like C++). More generally, C is pretty bad
                              ) for text handling as well.

                              In other words: There cannot be any commercial applicaiton written in C,
                              because in your view it is not well suited to one or two application
                              types you can think of.

                              Your argument is fundamentally flawed in two entirely separate, both
                              equally valid ways.

                              - That it is not the most well suited does not imply that it is impossible
                              that commercial software is written in it.
                              - There are many more commercial application types than the few you
                              mentioned.


                              It may be that you're trolling though. It is a very nice blanket statement
                              you made, one that will rile many people, and with a lot of wiggle room.


                              SaSW, Willem
                              --
                              Disclaimer: I am in no way responsible for any of the statements
                              made in the above text. For all I know I might be
                              drugged or something..
                              No I'm not paranoid. You all think I'm paranoid, don't you !
                              #EOT

                              Comment

                              • Richard Heathfield

                                #30
                                Re: C++ equivalent to spaghetti code

                                [followups set to clc]

                                James Kanze said:

                                <snip>
                                You can't really do accounting in C, for example,
                                Really? How strange. I've done loads of accounting in C. (But then I've
                                always been good at doing the impossible.)
                                because it has neither a
                                built in decimal type (like Cobol), nor operator overloading on
                                user defined types (like C++).
                                You don't need either of those to do accounting.
                                More generally, C is pretty bad for text handling as well.
                                It's easily good enough, given that just about the first thing most people
                                do in C is start work on their text-handling libraries.

                                --
                                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

                                Comment

                                Working...