Understanding large C++ programs

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

    #1

    Understanding large C++ programs

    X-No-Archive:

    Are there any good books that provide tips about how to understand and
    "play with" large C++ programs? It seems like a very important skill,
    and yet its hardly taught in the universities. Basic programming skills
    and knowledge of language constructs don't seem enough for
    understanding larger programs.

  • Victor Bazarov

    #2
    Re: Understanding large C++ programs

    sasquatch wrote:
    Are there any good books that provide tips about how to understand and
    "play with" large C++ programs?
    Actually, it doesn't matter in what language those programs are written.
    Understanding large systems requires a different approach than writing
    code. That's why in most cases it's a "software engineering" problem
    and not a "programmin g" one.
    It seems like a very important skill,
    Yes. And it's not a simple skill to teach. Knowing how to lay
    bricks isn't enough to build a house. However, you can learn to
    build houses without ever learning to lay bricks.
    and yet its hardly taught in the universities.
    I'll take your word for it.
    Basic programming
    skills and knowledge of language constructs don't seem enough for
    understanding larger programs.
    They aren't.

    V
    --
    Please remove capital 'A's when replying by e-mail
    I do not respond to top-posted replies, please don't ask


    Comment

    • Jim Langston

      #3
      Re: Understanding large C++ programs

      "sasquatch" <anketm@gmail.c omwrote in message
      news:1161204388 .530028.307840@ h48g2000cwc.goo glegroups.com.. .
      X-No-Archive:
      >
      Are there any good books that provide tips about how to understand and
      "play with" large C++ programs? It seems like a very important skill,
      and yet its hardly taught in the universities. Basic programming skills
      and knowledge of language constructs don't seem enough for
      understanding larger programs.
      Some large systems are easier to learn than others. It's not something that
      easily taught, as sometimes even understanding a small program can be a pain
      depending on how it's written.

      Generally when I want to understand a program I will load it up in my
      favorite editor and start putting it into a format I'm familiar with. This
      does two things, it makes it easier for me to read, but it also makes me
      familiar with the code. I will not save the editing I do, but it just helps
      me becuase I have to go through the entire code. I don't know if others do
      this. If, on the other hand, code is already in a format that's easy for me
      to read then I'm happy.

      One of the things I do there is change stupid variable names to ones that
      make sense if they didn't do that. Oh, they used ii for number of steps,
      let me change that to NumOfSteps with search and replace if I can, etc..

      Usually by the time I"m done with that I understand the code. If not, then
      I need to start looking at it closer.

      Some programs are just a joy to read, withi good structured code with
      logical variable names I find I can read it as easy as a book, if not
      easier.

      There was one program I was working on, however, modifying that even after 3
      months of working on it I still didn't understand that code fully, it was so
      horribly written (C code, not C++).

      I really don't know what to tell you.


      Comment

      • Noah Roberts

        #4
        Re: Understanding large C++ programs


        sasquatch wrote:
        X-No-Archive:
        >
        Are there any good books that provide tips about how to understand and
        "play with" large C++ programs? It seems like a very important skill,
        and yet its hardly taught in the universities. Basic programming skills
        and knowledge of language constructs don't seem enough for
        understanding larger programs.
        There is no real way to understand larger programs. The problem is too
        large for most human brains. You can understand the big picture if the
        design is good. You can understand particular parts very well and how
        they plug into the bigger design. Sometimes you know different parts
        than you do at other times. I can only wrap my head around a few
        thousand lines of code at once. This is why I use reminders
        (descriptive names and small functions) and constructs that are not
        easily used incorrectly.

        The real issue is being able to follow and decipher localized areas of
        code and create an understanding of the area you are working on. Some
        designs are easier than others in this regard; for instance, small
        functions are always easier to understand than long ones. One trick is
        to do what is called a scratch refactor...that is, go into the code and
        do some cleaning wherever you see a need, when you are done you throw
        it away and start over with a clearer idea of what is needed. It is
        described better in Working Effectively with Legacy Code by Michael
        Feathers...or you can google it.

        Speaking of google, some good keywords are "refactorin g" and "design
        patterns".

        Most Universities teach you next to nothing that you need in the
        workforce. This type of thing is only recieved through experience.
        There are plenty of OS projects you can play with, some are VERY large.
        You can always download the source and try to understand it even if
        they don't let you submit changes.

        Comment

        • Jens Müller

          #5
          Re: Understanding large C++ programs

          sasquatch schrieb:
          X-No-Archive:
          >
          Are there any good books that provide tips about how to understand and
          "play with" large C++ programs? It seems like a very important skill,
          and yet its hardly taught in the universities.
          Your university does not teach software engineering? Bad one ...

          Comment

          • AnonMail2005@gmail.com

            #6
            Re: Understanding large C++ programs


            sasquatch wrote:
            X-No-Archive:
            >
            Are there any good books that provide tips about how to understand and
            "play with" large C++ programs? It seems like a very important skill,
            and yet its hardly taught in the universities. Basic programming skills
            and knowledge of language constructs don't seem enough for
            understanding larger programs.
            Try "Large-Scale C++ Software Design", by John Lakos.

            Comment

            • sasquatch

              #7
              Re: Understanding large C++ programs


              Jens Müller wrote:
              sasquatch schrieb:
              X-No-Archive:

              Are there any good books that provide tips about how to understand and
              "play with" large C++ programs? It seems like a very important skill,
              and yet its hardly taught in the universities.
              >
              Your university does not teach software engineering? Bad one ...
              There is a difference between building software and understanding
              legacy systems. The first is taught in software engineering classes,
              the latter is not.

              Comment

              • ralph

                #8
                Re: Understanding large C++ programs

                sasquatch schrieb:
                X-No-Archive:
                >
                Are there any good books that provide tips about how to understand and
                "play with" large C++ programs?
                Spinellis: Code Reading

                hth
                ralpe

                Comment

                • Nick Keighley

                  #9
                  Re: Understanding large C++ programs

                  Jim Langston wrote:
                  "sasquatch" <anketm@gmail.c omwrote in message
                  Are there any good books that provide tips about how to understand and
                  "play with" large C++ programs? It seems like a very important skill,
                  and yet its hardly taught in the universities. Basic programming skills
                  and knowledge of language constructs don't seem enough for
                  understanding larger programs.
                  <snip>
                  Generally when I want to understand a program I will load it up in my
                  favorite editor and start putting it into a format I'm familiar with. This
                  does two things, it makes it easier for me to read, but it also makes me
                  familiar with the code. I will not save the editing I do, but it just helps
                  me becuase I have to go through the entire code. I don't know if others do
                  this. If, on the other hand, code is already in a format that's easy for me
                  to read then I'm happy.
                  this becomes impractical when kloc 200 or so

                  <snip>

                  --
                  Nick Keighley

                  Comment

                  • chandrahasanstar01@gmail.com

                    #10
                    Re: Understanding large C++ programs



                    On Oct 19, 1:46 am, "sasquatch" <ank...@gmail.c omwrote:
                    X-No-Archive:
                    >
                    Are there any good books that provide tips about how to understand and
                    "play with" large C++ programs? It seems like a very important skill,
                    and yet its hardly taught in the universities. Basic programming skills
                    and knowledge of language constructs don't seem enough for
                    understanding larger programs.
                    if you find answer " Please tell to me "

                    Comment

                    • Thomas Matthews

                      #11
                      Re: Understanding large C++ programs

                      sasquatch wrote:
                      X-No-Archive:
                      >
                      Are there any good books that provide tips about how to understand and
                      "play with" large C++ programs? It seems like a very important skill,
                      and yet its hardly taught in the universities. Basic programming skills
                      and knowledge of language constructs don't seem enough for
                      understanding larger programs.
                      >
                      I don't suggest understanding large programs.
                      Many large programs are too large for any one person to
                      comprehend and remember. In my years of experience,
                      large programs are divided into sections. Most people
                      working on the large programs have a general concept
                      of the sections, but detailed knowledge about a few.

                      Large programs are out of control. Large groups are
                      difficult to control.

                      --
                      Thomas Matthews

                      C++ newsgroup welcome message:

                      C++ Faq: http://www.parashift.com/c++-faq-lite
                      C Faq: http://www.eskimo.com/~scs/c-faq/top.html
                      alt.comp.lang.l earn.c-c++ faq:

                      Other sites:
                      http://www.josuttis.com -- C++ STL Library book
                      http://www.sgi.com/tech/stl -- Standard Template Library

                      Comment

                      Working...