Re: What's up with C++ (books)?

Kjell Rilbe <[email protected]> Wed, 1 Jun 2011 02:01:58 +0200
Newsgroups gmane.comp.programming.language-of-the-year
Organization DataDIA AB
Message-ID <[email protected]>
Den 2011-05-31 23:57 skrev Wayne Johnson s=E5h=E4r:
>  > I don't agree. There are differences. The complexity of C++ is so huge
>  > that the time wasted on dreary details is just too large for my taste.
>  > Sure, with years of experience, you do most things right automatically=
.
>  > The thing is that with for example C# you don't need years of
>  > experience. You just need a few weeks to get going. Note: I've tried
>  > both.
>  >
>
> But some problems by their very nature are complex. Language X isn't
> going to change that. I am still waiting for Haskell to be ported to the
> microprocessor I program for (it's supposed to solve all my problems)
> but right now I would settle for changing from C to C++.

No, the complexities of your "problem domain" remain the same, of=20
course. But I would be astonished if you were to say that assembler is=20
just as easy to write flawlessly as JavaScript. There *are* differences.

>  > But I guess this is kind of a religious matter, so maybe better just
>  > drop the whole discussion...
>
> Unfortunately, it does get religious, it shouldn't. Programming
> languages are just tools. You have to know how to use them. If you don't
> bad things happen. Java has resource leaks and if you pass yards into a
> functions that expects meters it doesn't matter which language you're
> programming in you just lost your Mars probe. If you try to add a bunch
> of floating point numbers together you better know the pitfalls our
> you'll get the wrong answer in almost every programming language.

But now you're talking about things that tend to be the same for all=20
"normal" languages, meaning high-level imperative ones.

What I mean is that in Java and C# you have memory management as opposed=20
to C++ (refcounted objects and smart pointers attempt to remedy the=20
deficit). In Delphi and C#, objects are always heap allocated and object=20
variables are inherently references, while in C++ they can reside on=20
either the heap or the stack and object variables can be value ones or=20
pointer ones. In C++ you more or less *have* to provide a copy=20
constructor to avoid sever damage and to keep yourself in order you=20
"should" conform to e.g. Coplien's Orthodox...

C++ is *littered* with "features" and details that can and will cause=20
you to make errors in your code.

In contrast, a lot of thought has gone into C# to avoid unnecessary=20
complexity and let you handle a lot of things at a higher and more=20
intuitive level, resulting in less coding errors and easier debugging.=20
You also tend to write more code that does more in less time than with C++.

> Writing good software is hard. Picking the right tool for the job is 50%
> of the chore. Writing the code is about the other 90%.

Yes, certainly, and I'm not saying C# is the right tool for any job. But=20
for the majority of desktop, server or web applications, I'd say C# is=20
probably the most productive and least error prone choise today, and C++=20
is among the worst ones.

> When I hear blanket condemnations (or commendation) of any language
> (except for Lisp -- just kidding ;-) it just rubs me the wrong way. The
> right programming language for the job depends on many factors (eg, area
> of experience, schedule, intended audience, target platform, etc.)

I'm not opposing that, but I really strongly believe that C++ is in=20
general not a very good choise today, unless you're targeting a platform=20
where you really only have C, C++ and assembler to choose from, or=20
require multi platform support. That's really where C and C++ excels,=20
but that's not something that's inherent in those languages, but simply=20
a question of tradition and politics.

Kjell
--=20
--------------------------------------
Kjell Rilbe
DataDIA AB
E-post: [email protected]
Telefon: 08-761 06 55
Mobil: 0733-44 24 64



------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/pragprog/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/pragprog/join
    (Yahoo! ID required)

<*> To change settings via email:
    [email protected]=20
    [email protected]

<*> To unsubscribe from this group, send an email to:
    [email protected]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/