A new kind of book to learn C++ computer programming

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

    A new kind of book to learn C++ computer programming


    I have written a computer programming book that uses C++.
    The book is for beginners in the field of computer programming,
    but it might give useful ideas also for more experienced
    programmers. Computer programs are presented in a very
    easy-to-read way in my book. To find out what that exactly
    means, please read the pages at



    There you can find free sample pages for printing and other
    useful information.

    I hope that it is ethically correct to advertize the
    book in this newsgroup.

    Sincerely,
    Mr. (Dr.) Kari Laitinen
    Oulu Institute of Technology, Finland
  • Alf P. Steinbach

    #2
    Re: A new kind of book to learn C++ computer programming

    On Thu, 11 Sep 2003 14:25:02 +0300, Kari Laitinen <kari.laitinen@ oamk.fi> wrote:
    [color=blue]
    >
    > I have written a computer programming book that uses C++.
    > The book is for beginners in the field of computer programming,
    > but it might give useful ideas also for more experienced
    > programmers. Computer programs are presented in a very
    > easy-to-read way in my book. To find out what that exactly
    > means, please read the pages at
    >
    > http://www.naturalprogramming.com/cppbook.html
    >
    > There you can find free sample pages for printing and other
    > useful information.
    >
    > I hope that it is ethically correct to advertize the
    > book in this newsgroup.[/color]

    Oh yes it is (although spam in general is frowned on).

    I looked briefly at chapter 5.

    You might want to use standard C++, e.g. <iostream>, instead of
    pre-standard C++, <iostream.h>. It took you some years to write that
    book, yes? Otherwise looks good.

    Comment

    • Sam Holden

      #3
      Re: A new kind of book to learn C++ computer programming

      On Thu, 11 Sep 2003 14:25:02 +0300, Kari Laitinen <kari.laitinen@ oamk.fi> wrote:[color=blue]
      >
      > I have written a computer programming book that uses C++.[/color]

      The first complete program I saw was:

      ---
      #include <iostream.h>

      int main()
      {
      cout << "I am a simple computer program." ;
      }
      ---

      Why not "<iostream> " and std::cout? What's the point of what I assume
      is a new book, not using the modern usage of the language?

      No terminating newline is going to make for confused users on many
      platforms.

      Later on in the "weddingdat es" program I see:

      #include <iostream.h>
      #include <sstream>
      #include <string>

      Which is a strange mix of the old and the new.

      Plus that program then uses 'string' not 'std::string' and hence
      won't compile...

      --
      Sam Holden

      Comment

      • Kari Laitinen

        #4
        Re: A new kind of book to learn C++ computer programming


        I have spent about 7 years in writing the book.
        I decided to use <iostream.h> instead of <iostream> because
        that way I did not have to say using namespace std ;
        at the beginning of every program. By dropping this statement
        I wanted to make the first programs a little bit less
        confusing for a beginner.
        [color=blue]
        >
        > You might want to use standard C++, e.g. <iostream>, instead of
        > pre-standard C++, <iostream.h>. It took you some years to write that
        > book, yes? Otherwise looks good.[/color]

        Comment

        • Kari Laitinen

          #5
          Re: A new kind of book to learn C++ computer programming


          All the programs can be compiled with the free Borland C++ 5.5
          compiler. It is true that a few programs in the last chapters
          require a statement like using namespace std ; in order to
          compile them with Microsoft C++ or with Unix/Linux compilers.

          Comment

          • Alf P. Steinbach

            #6
            Re: A new kind of book to learn C++ computer programming

            [Do not top-post (see the FAQ) -- rearranged]

            On Thu, 11 Sep 2003 15:08:47 +0300, Kari Laitinen <kari.laitinen@ oamk.fi> wrote:
            [color=blue][color=green]
            >> You might want to use standard C++, e.g. <iostream>, instead of
            >> pre-standard C++, <iostream.h>. It took you some years to write that
            >> book, yes? Otherwise looks good.[/color]
            >
            > I have spent about 7 years in writing the book.
            > I decided to use <iostream.h> instead of <iostream> because
            > that way I did not have to say using namespace std ;
            > at the beginning of every program. By dropping this statement
            > I wanted to make the first programs a little bit less
            > confusing for a beginner.[/color]

            Seven years ago, in 1996, that made very much sense. Even a year or
            two after the standard (which appeared late 1997) authors had to make
            the hard choice between practically non-compilable standard-conforming
            code, compilable non-standard code, or ugly hybrid solutions with "remove
            this if your compiler doesn't support namespaces" and the like. Today,
            however, most compilers conform to the then not yet existing standard wrt.
            this area, which means that some/many of the programs may not even compile,
            which is certainly _very_ confusing to the beginner... ;-)

            See [http://www.utvikling.com/cppfaq/01/03/index.html] for directions on
            obtaining standard-conforming free C++ compilers (this is in Norwegian).

            Perhaps it's possible to automate the conversion of most programs?

            Comment

            • jeffc

              #7
              Re: A new kind of book to learn C++ computer programming


              "Kari Laitinen" <kari.laitinen@ oamk.fi> wrote in message
              news:3F6065CF.F 1B9BBFE@oamk.fi ...[color=blue]
              >
              > I have spent about 7 years in writing the book.
              > I decided to use <iostream.h> instead of <iostream> because
              > that way I did not have to say using namespace std ;
              > at the beginning of every program. By dropping this statement
              > I wanted to make the first programs a little bit less
              > confusing for a beginner.[/color]

              Then you should at least say "This is not considered the proper way, but
              it's the least complicated in terms of readability for right now." It makes
              it worse later on when you mix <...h> and <...> together.


              Comment

              • Oliver S.

                #8
                Re: A new kind of book to learn C++ computer programming

                > ... which means that some/many of the programs may not even compile,[color=blue]
                > which is certainly _very_ confusing to the beginner... ;-)[/color]

                I hardly doubt that the old header-style isn't supported with any
                current compiler as it's too easy to maintain the second style and
                thereby to enable old apps to compile without changes.

                Comment

                • Alf P. Steinbach

                  #9
                  Re: A new kind of book to learn C++ computer programming

                  On 11 Sep 2003 14:47:56 GMT, "Oliver S." <Follow.Me@gmx. net> wrote:
                  [color=blue][color=green]
                  >> ... which means that some/many of the programs may not even compile,
                  >> which is certainly _very_ confusing to the beginner... ;-)[/color]
                  >
                  >I hardly doubt that the old header-style isn't supported with any
                  >current compiler as it's too easy to maintain the second style and
                  >thereby to enable old apps to compile without changes.[/color]

                  Difficult to grasp whether you mean you doubt (which would be unfounded
                  and stupid, since this thread contains one example of a program from that
                  book that doesn't compile), or whether you mean you don't doubt.

                  But with such unclear language, perhaps the thoughts that produced the
                  above are also somewhat muddled?

                  It wouldn't hardly surprise me.

                  Comment

                  • Artie Gold

                    #10
                    Re: A new kind of book to learn C++ computer programming

                    Kari Laitinen wrote:[color=blue]
                    > All the programs can be compiled with the free Borland C++ 5.5
                    > compiler. It is true that a few programs in the last chapters
                    > require a statement like using namespace std ; in order to
                    > compile them with Microsoft C++ or with Unix/Linux compilers.[/color]

                    ITYM "in order to conform to standard C++".

                    Platform/vendor/compiler is irrelevant.
                    Standards compliance is *always* relevant, particularly in teaching
                    materials.

                    Otherwise, it's not C++ you're teaching but, rather, a language that
                    looks a lot like C++, but isn't.

                    Cheers,
                    --ag

                    --
                    Artie Gold -- Austin, Texas

                    Comment

                    • Alf P. Steinbach

                      #11
                      Re: A new kind of book to learn C++ computer programming

                      On Thu, 11 Sep 2003 16:15:47 GMT, Artie Gold <artiegold@aust in.rr.com> wrote:
                      [color=blue]
                      >Kari Laitinen wrote:[color=green]
                      >> All the programs can be compiled with the free Borland C++ 5.5
                      >> compiler. It is true that a few programs in the last chapters
                      >> require a statement like using namespace std ; in order to
                      >> compile them with Microsoft C++ or with Unix/Linux compilers.[/color]
                      >
                      >ITYM "in order to conform to standard C++".
                      >
                      >Platform/vendor/compiler is irrelevant.
                      >Standards compliance is *always* relevant, particularly in teaching
                      >materials.
                      >
                      >Otherwise, it's not C++ you're teaching but, rather, a language that
                      >looks a lot like C++, but isn't.[/color]

                      From what little I saw I don't think the aim is to teach a particular
                      language, but programming in general.

                      Otherwise, I agree 100%.

                      Also that the code in the book needs to be reworked to standard C++.

                      Comment

                      • Default User

                        #12
                        Re: A new kind of book to learn C++ computer programming

                        Kari Laitinen wrote:[color=blue]
                        >
                        > All the programs can be compiled with the free Borland C++ 5.5
                        > compiler. It is true that a few programs in the last chapters
                        > require a statement like using namespace std ; in order to
                        > compile them with Microsoft C++ or with Unix/Linux compilers.[/color]

                        With so many good books that DO conform to the Standard (i.e. Koenig and
                        Moo), why would anyone bother with a book that is a mishmash of
                        standard, nonstandard and some downright incorrect usage?




                        Brian Rodenborn

                        Comment

                        • jeffc

                          #13
                          Re: A new kind of book to learn C++ computer programming


                          "Default User" <first.last@com pany.com> wrote in message
                          news:3F60BDF2.3 B3516EE@company .com...[color=blue]
                          > Kari Laitinen wrote:[color=green]
                          > >
                          > > All the programs can be compiled with the free Borland C++ 5.5
                          > > compiler. It is true that a few programs in the last chapters
                          > > require a statement like using namespace std ; in order to
                          > > compile them with Microsoft C++ or with Unix/Linux compilers.[/color]
                          >
                          > With so many good books that DO conform to the Standard (i.e. Koenig and
                          > Moo)...[/color]

                          You meant, of course, "e.g., Koenig and Moo". As you said, there are many
                          books that do conform.


                          Comment

                          • Default User

                            #14
                            Re: A new kind of book to learn C++ computer programming

                            jeffc wrote:[color=blue]
                            >
                            > "Default User" <first.last@com pany.com> wrote in message
                            > news:3F60BDF2.3 B3516EE@company .com...[/color]
                            [color=blue][color=green]
                            > > With so many good books that DO conform to the Standard (i.e. Koenig and
                            > > Moo)...[/color]
                            >
                            > You meant, of course, "e.g., Koenig and Moo". As you said, there are many
                            > books that do conform.[/color]

                            I did indeed.



                            Brian Rodenborn

                            Comment

                            • White Wolf

                              #15
                              Re: A new kind of book to learn C++ computer programming

                              Kari Laitinen wrote:[color=blue]
                              > I have spent about 7 years in writing the book.
                              > I decided to use <iostream.h> instead of <iostream> because
                              > that way I did not have to say using namespace std ;
                              > at the beginning of every program. By dropping this statement
                              > I wanted to make the first programs a little bit less
                              > confusing for a beginner.[/color]

                              Do not top post. Thanks.

                              Those headers might be supported - or might not. The standard does not
                              require it. And to teach beginners to use an outdated version of the C++
                              headers is not really a good idea. I mean worse than that. It may take
                              years to get rid off that habbit.

                              Not to mention that the old iostreams (strings etc.) were *not* the same as
                              the new ones. There are fundamental differences between the old and the
                              new.

                              I just do not like the idea to teach outdated things to people as a skill.
                              I find it hardly justifiable if justifiable at all.

                              And honestly. The justification of leaving out using namespace std; strikes
                              me as either laziness or ignorance. Laziness is inexcusable in teaching.
                              And probably the word ignorance is too harsh, but I must say I could not
                              find any lighter description of the fact that someone thinks that the only
                              difference (what matters) between the old (never standard) headers and the
                              new ones is the namespace std.

                              Classic iostreams and classic string are very different from the old one.
                              Very.

                              Bjarne Stroustrup, Andrew Koenig, (IIRC) Francis Glassborow, Stanley B.
                              Lippman etc. could all solve to use the right headers. And Francis'es book
                              is a book which happens to use C++ to teach computer programming - but not
                              in itself is a C++ book as its main goal.

                              So in 2003 I find it inexcusable to teach a technique (to beginners), which
                              was outdated approx. 7 years ago. And I do that will all due respect to the
                              work placed into the book. But I had enough trouble constantly brainwashing
                              people to elminate Schildt contamination. I really do not need greenhorns
                              agruing: "but this must be correct! I have read it in a book, which was
                              published in 2003!"

                              --
                              WW aka Attila


                              Comment

                              Working...