Code reading/Understanding - A general question

B

boki_pfc

Hi Everybody,

I am looking for an advice on following:
I have that "pleasure" of reading C++ codes that have been written by
person(s) that have not attended the same C++ classes that I did or
have not read the same C++ books that I have read. This kind of
people has written some parts of the code that use notations that I am
not familiar with (and that probably also includes also 50 % of other C
++ programmers). While everybody who has read a code has had that
pleasure of pulling their hair out trying to read the code that has no
comments or documentation but (in this case) I am not trying to find
the solution to such a problem. What I am looking for are books/
articles/Know-all-Inc-double-latte-coffee (is a coffee that once drank
will all of sudden make you understand every possible syntax ever
written in C++) that will allow me to be able to read the not-so-often
used C++ syntax. First guess would be to read latest ANSI/ISO C++
standard but they tend to be fairly hard to understand. That being
said I did not read ANSI/ISO standard for C++ (feel free to comment on
the C++ standard). What also would be helpful in my case? For
example, books that use/and explain non-traditional syntax of C++. I
am looking for examples of those. Detailed reference books would also
be good.
So in short I am looking for a way to help me understand quicker the
"non-traditional" C++ syntax. Help will be appreciated.

Everybody.... Thank you for your time.
Humbly,
Bo
 
G

gMorphus

Hi Everybody,

I am looking for an advice on following:
I have that "pleasure" of reading C++ codes that have been written by
person(s) that have not attended the same C++ classes that I did or
have not read the same C++ books that I have read. This kind of
people has written some parts of the code that use notations that I am
not familiar with (and that probably also includes also 50 % of other C
++ programmers). While everybody who has read a code has had that
pleasure of pulling their hair out trying to read the code that has no
comments or documentation but (in this case) I am not trying to find
the solution to such a problem. What I am looking for are books/
articles/Know-all-Inc-double-latte-coffee (is a coffee that once drank
will all of sudden make you understand every possible syntax ever
written in C++) that will allow me to be able to read the not-so-often
used C++ syntax. First guess would be to read latest ANSI/ISO C++
standard but they tend to be fairly hard to understand. That being
said I did not read ANSI/ISO standard for C++ (feel free to comment on
the C++ standard). What also would be helpful in my case? For
example, books that use/and explain non-traditional syntax of C++. I
am looking for examples of those. Detailed reference books would also
be good.
So in short I am looking for a way to help me understand quicker the
"non-traditional" C++ syntax. Help will be appreciated.

Everybody.... Thank you for your time.
Humbly,
Bo

At first I was thinking you are trying to find a method of
understanding some legacy code. Later I figured you are having
difficulties to understand some of the different syntax you are
running into.
For that matter, I am not so sure there is a magic book. Furter more,
I don't realy have get what kind of syntax you can't understand...
May be I missunderstood your problem.

Anyhow, if you are trying to break down some existing code I strongly
suggest using Doxygen (or one the similar tools).
It takes some time to figure out exactly what options you'd like to
use, but you get a realy nice output, including different call graphs,
class diagrams, collaboration etc.
Tip: Install 'graphviz' tool to get the graphs and diagrams.

Good Luck,
Guy
 
B

boki_pfc

At first I was thinking you are trying to find a method of
understanding some legacy code. Later I figured you are having
difficulties to understand some of the different syntax you are
running into.
For that matter, I am not so sure there is a magic book. Furter more,
I don't realy have get what kind of syntax you can't understand...
May be I missunderstood your problem.

Anyhow, if you are trying to break down some existing code I strongly
suggest using Doxygen (or one the similar tools).
It takes some time to figure out exactly what options you'd like to
use, but you get a realy nice output, including different call graphs,
class diagrams, collaboration etc.
Tip: Install 'graphviz' tool to get the graphs and diagrams.

Good Luck,
Guy- Hide quoted text -

- Show quoted text -

Hi Guy,

Thank you for the reply. To clarify you further: In most cases it is
question of a legacy code. That legacy code typically uses constructs
(syntax) that are not normally used (or are considered obsolete) but
can still be compiled in to working code. Todays books/articles use
"more modern" code that is in almost all the cases more appropriate/
efficient/nicer looking/more readable/etc. They do not explain these
"old" ways of implementing certain solutions. So to be more clearer I
am looking for books/articles that will allow me to quickly find
explanations of particular syntax. I am looking for the inverse of
"International Obfuscated C Code Contest". I would like to speed up
my understanding of the C++ code (the syntax part of it and not the
functionality; as you mentioned Doxygen is helpful to understand the
functionality, however not the syntax). So I am looking for good
books to help me(no book will help me solve all of it but several will
probably will).

Kind regards,
Bo
 
J

John Harrison

Hi Guy,

Thank you for the reply. To clarify you further: In most cases it is
question of a legacy code. That legacy code typically uses constructs
(syntax) that are not normally used (or are considered obsolete) but
can still be compiled in to working code. Todays books/articles use
"more modern" code that is in almost all the cases more appropriate/
efficient/nicer looking/more readable/etc. They do not explain these
"old" ways of implementing certain solutions. So to be more clearer I
am looking for books/articles that will allow me to quickly find
explanations of particular syntax. I am looking for the inverse of
"International Obfuscated C Code Contest". I would like to speed up
my understanding of the C++ code (the syntax part of it and not the
functionality; as you mentioned Doxygen is helpful to understand the
functionality, however not the syntax). So I am looking for good
books to help me(no book will help me solve all of it but several will
probably will).

Kind regards,
Bo

Your best approach is to post the obscure syntax here and ask us about
it. Actually I think it is modern C++ that uses obscure syntax not old
C++ (which is more C like). But without seeing examples of what you are
struggling with it's hard to say. Post some code!

You definitely don't won't to look at the C++ standard, that will not
help you at all. I don't know of any book dedicated to 'understanding
old C++ syntax', better to access to accumulated wisdom of the regulars
here. There are many, many man-years available to you!

john
 
P

Puppet_Sock

On Jun 1, 6:02 am, (e-mail address removed) wrote:
[snip]
I have that "pleasure" of reading C++ codes that have
been written by
person(s) that have not attended the same C++ classes
that I did or
have not read the same C++ books that I have read.

In a commercial situation, it may be worthwhile to get
the author of the code and make them explain it. Even
if you have to pay (or your company has to pay) for
some hours, it may be worth it.

There are some tools out there that do some levels
of "de-obfuscation." I've not had a lot of experience
with them. But they were designed to reduce the
"George factor." That is "George wrote this, I can't
figure it out, and George is only available on contract
at a rate the company hates to pay." Eventually the
company gets the idea that the software tool is cheaper
than paying George's hourly rate. Ordinarily such tools
are not exactly cheap.

For future work: A company software design style guide
is not a bad idea. Though it should have some level
of flexibility and not be seen as a straight jacket.
It should give guidance on things to do and things
to avoid so that code is reasonably easy to read.
You could do worse than starting by making everybody
read _Code Complete_.
Socks
 
J

Jim Langston

Hi Everybody,

I am looking for an advice on following:
I have that "pleasure" of reading C++ codes that have been written by
person(s) that have not attended the same C++ classes that I did or
have not read the same C++ books that I have read. This kind of
people has written some parts of the code that use notations that I am
not familiar with (and that probably also includes also 50 % of other C
++ programmers). While everybody who has read a code has had that
pleasure of pulling their hair out trying to read the code that has no
comments or documentation but (in this case) I am not trying to find
the solution to such a problem. What I am looking for are books/
articles/Know-all-Inc-double-latte-coffee (is a coffee that once drank
will all of sudden make you understand every possible syntax ever
written in C++) that will allow me to be able to read the not-so-often
used C++ syntax. First guess would be to read latest ANSI/ISO C++
standard but they tend to be fairly hard to understand. That being
said I did not read ANSI/ISO standard for C++ (feel free to comment on
the C++ standard). What also would be helpful in my case? For
example, books that use/and explain non-traditional syntax of C++. I
am looking for examples of those. Detailed reference books would also
be good.
So in short I am looking for a way to help me understand quicker the
"non-traditional" C++ syntax. Help will be appreciated.

There are basically only a few things that makes up C++ code, keywords,
operators, syntax, function calls and the STL. If you come across one you
don't understand then you can try googling for it or asking it here or
alt.comp.lang.learn.c-c++. For more simplistic questions
alt.comp.lang.learn.c-c++ may be better since there no one asks you "and
just what book are you reading that doesn't explain xxxxxx" which I've
always considered a bit rude.

One such example is an initialiation list which is one of the more frequent
sytnax questions:

class Foo
{
public:
Foo( int bar ): Bar_( bar ) {}
private:
int Bar_;
};

Without a book explainging initialization lists that is not easy to
understand. Once you find out about initialization lists, it becomes second
nature. (I dont' know if you know about initialization lists or not so
won't explain it at this point).

Feel free to ask.
 
J

James Kanze

[...]
There are basically only a few things that makes up C++ code, keywords,
operators, syntax, function calls and the STL. If you come across one you
don't understand then you can try googling for it or asking it here or
alt.comp.lang.learn.c-c++. For more simplistic questions
alt.comp.lang.learn.c-c++ may be better since there no one asks you "and
just what book are you reading that doesn't explain xxxxxx" which I've
always considered a bit rude.
One such example is an initialiation list which is one of the more frequent
sytnax questions:
class Foo
{
public:
Foo( int bar ): Bar_( bar ) {}
private:
int Bar_;

};
Without a book explainging initialization lists that is not easy to
understand.

If he learned C++ from a book that didn't explain initialization
lists, he should find another book. It's a basic part of C++,
and their use is required in all of the coding guidelines I've
ever seen.

It would be interesting to see what sort of notations he's
talking about. It would give us a better idea of the books he's
read, and where he should go from there.
 
B

boki_pfc

I am looking for an advice on following:
I have that "pleasure" of reading C++ codes that have been written by
person(s) that have not attended the same C++ classes that I did or
have not read the same C++ books that I have read. This kind of
people has written some parts of the code that use notations that I am
not familiar with (and that probably also includes also 50 % of other C
++ programmers).
[...]





There are basically only a few things that makes up C++ code, keywords,
operators, syntax, function calls and the STL. If you come across one you
don't understand then you can try googling for it or asking it here or
alt.comp.lang.learn.c-c++. For more simplistic questions
alt.comp.lang.learn.c-c++ may be better since there no one asks you "and
just what book are you reading that doesn't explain xxxxxx" which I've
always considered a bit rude.
One such example is an initialiation list which is one of the more frequent
sytnax questions:
class Foo
{
public:
Foo( int bar ): Bar_( bar ) {}
private:
int Bar_;
};
Without a book explainging initialization lists that is not easy to
understand.

If he learned C++ from a book that didn't explain initialization
lists, he should find another book. It's a basic part of C++,
and their use is required in all of the coding guidelines I've
ever seen.

It would be interesting to see what sort of notations he's
talking about. It would give us a better idea of the books he's
read, and where he should go from there.

--
James Kanze (Gabi Software) email: (e-mail address removed)
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34- Hide quoted text -

- Show quoted text -

Hi Everybody,

Thank you for your comments. I liked the "George factor" comment.
Unfortunatelly in most of the cases that give me a trouble are the
ones where the "George" was employed by company X 10 years ago and
nobody who is in the company X knows where George is (in some extreme
cases they do not know who George was). The sad part is that the 10
year old code if not properly documented cannot be understod even by
George.

Jim: I agree with your comment and would like to add the following:
The user will have hard time finding it on the net/book if she/he does
not know that the syntax that you had shown is called "initialization
list". I also agree with James that C++ book has to cover
"initialization list" but they might not to.

I agree that newsgroups are the best place to ask. By far.

So to boil it down to a point:
Could someone name me three good detailed/big reference books for C+
+? Has anybody read the ISO/ANSI standard? How good it is as
reference? (Please do not beat me down for saying this: I like
standards. No joke.)

Kind regards,
Bo
 
H

Herby

Is it the style of coding that has been written?
Or just C++ syntax in general - over the years C++ has not changed
that much.
So i assume the former else you just need to learn C++ the traditional
way.
You only need to google 'C++ recommended reading'

Else if it is the coding style...

I would say welcome to the real world of working as a software
developer.
Having to navigate through code written by someone who does not really
read those books.

I have started a similar thread on being able to reverse engineer such
code into a more meaningful medium.

I have tried many tools and have yet to find one that i do use day to
day because it helps me maintain and understand some source not
written by me( or someone from the same school, in fact someone from
any school ).

To the extend i am seriously considering writing my own.

Maybe u could try some tools
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top