C++ equivalent to spaghetti code

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

    #31
    Re: C++ equivalent to spaghetti code

    On 20 Jul., 21:59, James Kanze <james.ka...@gm ail.comwrote:
    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).
    >
    That was the case for "my" financial application. It had decimal-based
    arithmetic, and writing expressions in C was
    add(multiply(a, b),divide(c,d)) instead of a*b+ c/d. But as a lot of
    the high-level code was written in our own, interpreted language
    anyway it did not matter so much.

    /Peter

    Comment

    • Wolfgang Draxinger

      #32
      Re: C++ equivalent to spaghetti code

      Sherman Pendley wrote:
      "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?!

      Coding something in C doesn't mean you must abandon using OOP
      methods. It just means, that things are going to be a bit more
      verbose (i.e. you've to maintain everything yourself).

      Wolfgang Draxinger
      --
      E-Mail address works, Jabber: hexarith@jabber .org, ICQ: 134682867

      Comment

      • David Kastrup

        #33
        Re: C++ equivalent to spaghetti code

        Wolfgang Draxinger <wdraxinger@dar kstargames.dewr ites:
        Sherman Pendley wrote:
        >
        >"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?!
        >
        Coding something in C doesn't mean you must abandon using OOP
        methods. It just means, that things are going to be a bit more
        verbose (i.e. you've to maintain everything yourself).
        Well, message passing, the fundamental defining characteristic of OOP (I
        mean, this is what made Smalltalk revolutionary with regard to
        programming techniques and gave it its name) requires you to switch
        sustained execution contexts, basically switching to a different stack,
        eveery object having its own control flow. Synchronous multithreading
        or whatever you want to call it. That's what OO is actually about. The
        in-memory and synchronous in-process equivalent to separate applications
        with separate control flow talking to one another via pipes.

        Of course, C++ does not have it either. When it laid claim to the
        buzzphrase OO, its reference implementation Cfront could not map this
        aspect to C, and so one implemented and declared a humongous wagonload
        of other features to befuddle detractors and turn them away in disgust
        before they noticed the missing essential detail.

        The Cfront language design inheritage indeed means that for the most
        part, you can't do anything in C++ that is not fundamentally accessible
        in C.

        --
        David Kastrup, Kriemhildstr. 15, 44793 Bochum

        Comment

        • fnegroni

          #34
          Re: C++ equivalent to spaghetti code

          On Jul 20, 10:15 pm, Wolfgang Draxinger <wdraxin...@dar kstargames.de>
          wrote:
          Coding something in C doesn't mean you must abandon using OOP
          methods. It just means, that things are going to be a bit more
          verbose (i.e. you've to maintain everything yourself).
          Sorry, but I fail to see how OOP applies to C.

          I heard someone give me an example once, which was not OOP.

          So I am curious to know what sort of OOP we are talking about here.

          If I want to do OOP, I can use C++, Java, Eiffel, Python... certainly
          not C.

          Doing OOP in C is IMHO silly.

          C is best at what it was designed to do, and that was not OOP.

          I think a study of Yourdon and Structured Programming might be an
          interesting read for those advocating OOP in C.

          Comment

          • lawrence.jones@siemens.com

            #35
            Re: C++ equivalent to spaghetti code

            Willem <willem@stack.n lwrote:
            >
            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.
            I don't think that's what James meant. I think when he said "commercial
            application", he really meant "business data processing application". C
            really *isn't* well suited to most BDP applications, so his statement is
            much more reasonable when interpreted that way. But I still suspect
            that there are at least a few BDP applications written in C nonetheless.
            --
            Larry Jones

            Hello, local Navy recruitment office? Yes, this is an emergency... -- Calvin

            Comment

            • Willem

              #36
              Re: C++ equivalent to spaghetti code

              lawrence.jones@ siemens.com wrote:
              ) I don't think that's what James meant. I think when he said "commercial
              ) application", he really meant "business data processing application". C
              ) really *isn't* well suited to most BDP applications, so his statement is
              ) much more reasonable when interpreted that way. But I still suspect
              ) that there are at least a few BDP applications written in C nonetheless.

              Just for the record:
              I'm a software engineer for a company that does mortgages, and
              we have plenty of C software in use that does data processing.


              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

                #37
                Re: C++ equivalent to spaghetti code

                lawrence.jones@ siemens.com said:
                Willem <willem@stack.n lwrote:
                >>
                >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.
                >
                I don't think that's what James meant. I think when he said "commercial
                application", he really meant "business data processing application". C
                really *isn't* well suited to most BDP applications, so his statement is
                much more reasonable when interpreted that way.
                Whether you have interpreted him correctly is not for me to say, but what I
                am in a position to say is that I've written plenty of "BDP" applications
                in C, and I found it a very suitable language for the purpose. That is not
                to say that there are no other such languages, of course, but it's one of
                the better ones. I've used quite a few languages for "BDP", and I'd rank C
                in the top two of those few. Whether I'd place it first or second is a
                tough call. (C++ ranks a close third in my estimation.)
                But I still suspect
                that there are at least a few BDP applications written in C nonetheless.
                Loads. Absolutely loads.

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

                • Wolfgang Draxinger

                  #38
                  Re: C++ equivalent to spaghetti code

                  David Kastrup wrote:
                  Well, message passing, the fundamental defining characteristic
                  of OOP (I mean, this is what made Smalltalk revolutionary with
                  regard to programming techniques and gave it its name) requires
                  you to switch sustained execution contexts, basically switching
                  to a different stack, eveery object having its own control
                  flow. Synchronous multithreading or whatever you want to call
                  it. That's what OO is actually about. The in-memory and
                  synchronous in-process equivalent to separate applications with
                  separate control flow talking to one another via pipes.
                  The language I'm currently developing uses C as an intermediate.
                  And in this language message passing is one of the core
                  machanisms. And yes, of course message passing is possible, you
                  just may not implement it in form of simple function calling.

                  The runtime of my language implements a message dispatcher, that
                  delivers messages to each object on the reciever list. An object
                  can decide if it accepts the message and processes it, or if it
                  passes it on, or accepts and re-yields the message. For example
                  it is possible to send a message in a way, that it will be
                  passed up in the hierachy of object instances.

                  Wolfgang Draxinger
                  --
                  E-Mail address works, Jabber: hexarith@jabber .org, ICQ: 134682867

                  Comment

                  • Richard Harter

                    #39
                    Re: C++ equivalent to spaghetti code

                    On Mon, 21 Jul 2008 20:34:02 +0000, Richard Heathfield
                    <rjh@see.sig.in validwrote:
                    >lawrence.jones @siemens.com said:
                    >
                    >Willem <willem@stack.n lwrote:
                    >>>
                    >>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.
                    >>
                    >I don't think that's what James meant. I think when he said "commercial
                    >application" , he really meant "business data processing application". C
                    >really *isn't* well suited to most BDP applications, so his statement is
                    >much more reasonable when interpreted that way.
                    >
                    >Whether you have interpreted him correctly is not for me to say, but what I
                    >am in a position to say is that I've written plenty of "BDP" applications
                    >in C, and I found it a very suitable language for the purpose. That is not
                    >to say that there are no other such languages, of course, but it's one of
                    >the better ones. I've used quite a few languages for "BDP", and I'd rank C
                    >in the top two of those few. Whether I'd place it first or second is a
                    >tough call. (C++ ranks a close third in my estimation.)
                    But, Richard, you place C first or second in all applications.
                    :-)
                    >
                    >But I still suspect
                    >that there are at least a few BDP applications written in C nonetheless.
                    >
                    >Loads. Absolutely loads.
                    >
                    >--
                    >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
                    Richard Harter, cri@tiac.net
                    http://home.tiac.net/~cri, http://www.varinoma.com
                    Save the Earth now!!
                    It's the only planet with chocolate.

                    Comment

                    • s0suk3@gmail.com

                      #40
                      Re: C++ equivalent to spaghetti code

                      On Jul 21, 3:53 am, fnegroni <f.e.negr...@go oglemail.comwro te:
                      On Jul 20, 10:15 pm, Wolfgang Draxinger <wdraxin...@dar kstargames.de>
                      wrote:
                      >
                      Coding something in C doesn't mean you must abandon using OOP
                      methods. It just means, that things are going to be a bit more
                      verbose (i.e. you've to maintain everything yourself).
                      >
                      Sorry, but I fail to see how OOP applies to C.
                      >
                      I heard someone give me an example once, which was not OOP.
                      >
                      So I am curious to know what sort of OOP we are talking about here.
                      >
                      If I want to do OOP, I can use C++, Java, Eiffel, Python... certainly
                      not C.
                      >
                      Doing OOP in C is IMHO silly.
                      >
                      Silly, ridiculous, painful... but frequently just necessary.

                      Comment

                      • Pete Becker

                        #41
                        Re: C++ equivalent to spaghetti code

                        On 2008-07-23 03:42:29 -0400, James Kanze <james.kanze@gm ail.comsaid:
                        On Jul 22, 7:21 pm, Ben Pfaff <b...@cs.stanfo rd.eduwrote:
                        >James Kanze <james.ka...@gm ail.comwrites:
                        >>C doesn't have any support for decimal arithmetic, nor any means
                        >>of adding it comfortably.
                        >>
                        Yes, I'd heard about this. But I wasn't too sure of its status,
                        and it isn't implemented by the compilers I regularly use.
                        >
                        C and C++ both have TR's for decimal floating-point in the works. They
                        were paused, waiting for IEEE-754R, a revision to IEEE-754 that
                        includes decimal floating-point, to be completed. That happened a month
                        or so ago, and now both TR's are moving forward.

                        --
                        Pete
                        Roundhouse Consulting, Ltd. (www.versatilecoding.com) Author of "The
                        Standard C++ Library Extensions: a Tutorial and Reference
                        (www.petebecker.com/tr1book)

                        Comment

                        Working...