Re: C vs. C++



On 2009-01-16, Malcolm McLean <regniztar@xxxxxxxxxxxxxx> wrote:

"John Bode" <jfbode1029@xxxxxxxxx> wrote in message
Jacob's not wrong in that there are aspects of C++ where the rules are
so complicated that code becomes impossible to understand via simple
inspection; however, it does not follow that C is inherently superior
to C++ by virtue of those issues.

It means that C++ allows for a possibility of bad programming that C
excludes. Since most softwware projects that fail do so because the human
programmers cannot manage the complexity of what they have created, this is
quite a serious drawback.

If this is the case, the complexity leading to the failure is in the /project/,
not in the /programming language/.

Complexity has to exist somewhere. If you banish it from the programming
language, you push it into the programs. It's not an exact conservation law,
because a given amount of complexity in one place may translate into vastly
more complexity if it is relocated to another place, due to duplication of
effort.

C++ can manage certain complexities that are otherwise difficult in C.

As a rule:

language simplicity => program complexity

It helps to look at backwards. If you have large body of code written in a
complex programming language, and you want to simplify the programming
language, as a rule that will require adding reams of code to that existing
code to compensate. Every little thing you remove from the language will
potentially have an impact over broad areas of the existing code base,
potentially requiring reams of complexity to be heaped onto it.

Whatever /single/ thing you don't have in a language for taking care of some
responsibility translates to countless repetition of that responsibility.
This is particularly true of language features that generate code. It's less
true of library features. If you take a function out of a library, you might be
able to just add that function to your program. You might have a big library
used by everyone in your your software organization, so you might be able to
just add it in one place even for many programs. But there are still other
organizations that will be similarly reinventing the function.

You might not like C++ templates, but what would have to be done to a C++
codebase that is based on templates, if templates were taken away, and how does
that task compare to the complexity of templates? What if the codebase is much
larger and more complex than the implementation of templates?
.



Relevant Pages

  • Re: C vs. C++
    ... language, you push it into the programs. ... because a given amount of complexity in one place may translate into vastly ... but the unnecessary complexity tied to the use of an obscure programming ... You can use any of the several libraries ...
    (comp.lang.c)
  • Re: C vs. C++
    ... codebase that is based on templates, if templates were taken away, and how ... > does that task compare to the complexity of templates? ... In general, the simpler the language, the more debugging you have to do ... rarely have debugging support at all, ...
    (comp.lang.c)
  • Re: the necessity of Lisps Objects?
    ... know the language, you still cannot ascertain how long your function ... different ways and have different orders of complexity. ... optimisation is going to be hit and miss. ... While I don't disagree with the premise that programming languages ...
    (comp.lang.lisp)
  • Re: C vs. C++
    ... Then you need templates to try to control the mess. ... So one type of complexity is addressed by adding another layer of ... more often the human programmer cannot ... to debug than it would have been written in a simpler language. ...
    (comp.lang.c)
  • Re: Java is becoming the new Cobol
    ... drag, kicking and screaming, into structured programming, were beyond ... Believe me, I don't have a problem with complexity, when it's warranted. ... The "data" doesn't back up your impressions at all. ... Structured Programming is a useful and powerful ...
    (comp.lang.cobol)