Book Recommendations?

L

Lester Manry

First I wish to appoligies if this is OT and should be posted
elsewhere. I've done a google group search and read the
Comp.Lang.C FAQ in hopes of avoiding a OT or FAQ. Please direct
me to a better group if this is OT :)

I am wanting to incress my understanding of programming practises
used by professional C programmers. I feel comfortable with C
programming and modifing existing programs, but feel at a lost
when I wish to start my own project.

I understand that there are steps professional programmers usualy
take either individually or as a team, before even writing the
first line of code. Some of the things I've heared here and there
are:

* Writing some kind of documentation that describes what the
program is for and what it will do and what it won't do.

* Deciding (possibly documenting) when and what order to do the
things listed in the documentation above.

* Deciding on what standards will be used when writing the code.

* Deciding what parts of C can and cannot be used. (eg disallow
the use of goto, static, keeing global variables to a minimium,
etc.)

and I'm sure there are lots of other stuff I haven't heard of that
could be added to this list :)

I have looked for books that deal with this topic at bookstores.
There seems to be many books around. I've been hesitent to buy one
yet, experence shows there are books to be avoided and books that
are considered a MUST.

What books have helped those who read comp.lang.c in better
preparing to start a project? What books would you recommend? What
books should I avoid?

I would prefer books writen by someone with years of C programming
experence, who knows the subject deeply. I would also prefer a book
that gives good examples. I understand best by explainations followed
by good/realistic examples.

I hope this isn't asking too much...
 
M

Mike Wahler

Lester Manry said:
First I wish to appoligies if this is OT and should be posted
elsewhere. I've done a google group search and read the
Comp.Lang.C FAQ in hopes of avoiding a OT or FAQ. Please direct
me to a better group if this is OT :)

I am wanting to incress my understanding of programming practises
used by professional C programmers. I feel comfortable with C
programming and modifing existing programs, but feel at a lost
when I wish to start my own project.

I understand that there are steps professional programmers usualy
take either individually or as a team, before even writing the
first line of code. Some of the things I've heared here and there
are:

* Writing some kind of documentation that describes what the
program is for and what it will do and what it won't do.

* Deciding (possibly documenting) when and what order to do the
things listed in the documentation above.

* Deciding on what standards will be used when writing the code.

* Deciding what parts of C can and cannot be used. (eg disallow
the use of goto, static, keeing global variables to a minimium,
etc.)

and I'm sure there are lots of other stuff I haven't heard of that
could be added to this list :)

I have looked for books that deal with this topic at bookstores.
There seems to be many books around. I've been hesitent to buy one
yet, experence shows there are books to be avoided and books that
are considered a MUST.

What books have helped those who read comp.lang.c in better
preparing to start a project? What books would you recommend? What
books should I avoid?

I would prefer books writen by someone with years of C programming
experence, who knows the subject deeply. I would also prefer a book
that gives good examples. I understand best by explainations followed
by good/realistic examples.

I hope this isn't asking too much...

I suspect there are good books about the above, but you're not
really asking about the C language, but about software design
and development methods (these issues would apply for any
language). So imo this isn't the place to ask. One place to
ask would be a more general newsgroup such as 'comp.programming'.
You might also find of interest the 'Extreme Programming' (aka
'XP') ideas: http://www.extremeprogramming.org/

-Mike
 
C

CBFalconer

Lester said:
.... snip ...

I am wanting to incress my understanding of programming practises
used by professional C programmers. I feel comfortable with C
programming and modifing existing programs, but feel at a lost
when I wish to start my own project.

I understand that there are steps professional programmers usualy
take either individually or as a team, before even writing the
first line of code. Some of the things I've heared here and there
are:
.... snip ...

* Deciding what parts of C can and cannot be used. (eg disallow
the use of goto, static, keeing global variables to a minimium,
etc.)

What ever gave you the idea of disallowing static? This is an
extremely useful word, especially when applied to functions.
.... snip ...

What books have helped those who read comp.lang.c in better
preparing to start a project? What books would you recommend? What
books should I avoid?

Try "The Practice of Programming", by Kernighan and Pike. For a
good view of the methodology of successive refinement try
"Algorithms + Data Structures = Programs" by Wirth, if you can
find it.

comp.programming is better suited for this subject.
 
M

Malcolm

Lester Manry said:
First I wish to appoligies if this is OT and should be posted
elsewhere. I've done a google group search and read the
Comp.Lang.C FAQ in hopes of avoiding a OT or FAQ. Please direct
me to a better group if this is OT :)
As others have said. comp.programming is more the forum for general software
design issues.
I understand that there are steps professional programmers usualy
take either individually or as a team, before even writing the
first line of code. Some of the things I've heared here and there
are:
There's no such thing as a professional programmer, which is part of the
problem.
There are also hundreds of formal methods, all claiming to be the one true
design methodology. Usually these are advanced by ambitious people with
bullying personality, who see the personal advantage in being the authority
on software developement methods. Most methods suffer from trivial
weaknesses, the most usual one being that following the method imposes a
similar burden on the programmer to writing bug-free code at first try.
However some are useful.
Which method to use depends very largely on the type of application you are
going to write. A quick utilty of no real importance - eg a program to take
an image, snip off the bordering pixels, and save the cropped image - can be
written "straight off" without any planning. Safety-critical code, on the
other hand, demands some sort of formal testing at the very least.
* Writing some kind of documentation that describes what the
program is for and what it will do and what it won't do.
Sort of. Obviously you have to have some idea what you are going to achieve
before you start any project. Some programs grow as functions undreamt of
are added, at other times you have a formal specification agreed with by the
client.
* Deciding (possibly documenting) when and what order to do the
things listed in the documentation above.
This can be done, but is rather a mistake. An architect wouldn't decide "The
bridge must carry cars, a railway, and people. So I'll make it carry people
first, then add railway capacity."
* Deciding on what standards will be used when writing the code.
Normally you have house standards.
* Deciding what parts of C can and cannot be used. (eg disallow
the use of goto, static, keeing global variables to a minimium,
etc.)
For C this is usually a bad policy, because the language is so small. For
any programming language, you need to consider carefully about disallowing
part of it, because most constructs are there for a reason.
However malloc() and free() may be disallowed, which totally changes the way
most C programs are written.
What books have helped those who read comp.lang.c in better
preparing to start a project? What books would you recommend? What
books should I avoid?
Try

The Mythical Man-Month, by Frederick P. Brooks.
Code Complete, by Steve McConnell

There are also losts of books advocating the specific formal methods. We
don't use any of them in our working environment, so I'm not the person to
recommend.
 
J

Jack Klein

First I wish to appoligies if this is OT and should be posted
elsewhere. I've done a google group search and read the
Comp.Lang.C FAQ in hopes of avoiding a OT or FAQ. Please direct
me to a better group if this is OT :)

I am wanting to incress my understanding of programming practises
used by professional C programmers. I feel comfortable with C
programming and modifing existing programs, but feel at a lost
when I wish to start my own project.

I understand that there are steps professional programmers usualy
take either individually or as a team, before even writing the
first line of code. Some of the things I've heared here and there
are:

* Writing some kind of documentation that describes what the
program is for and what it will do and what it won't do.

* Deciding (possibly documenting) when and what order to do the
things listed in the documentation above.

* Deciding on what standards will be used when writing the code.

* Deciding what parts of C can and cannot be used. (eg disallow
the use of goto, static, keeing global variables to a minimium,
etc.)

and I'm sure there are lots of other stuff I haven't heard of that
could be added to this list :)

I have looked for books that deal with this topic at bookstores.
There seems to be many books around. I've been hesitent to buy one
yet, experence shows there are books to be avoided and books that
are considered a MUST.

What books have helped those who read comp.lang.c in better
preparing to start a project? What books would you recommend? What
books should I avoid?

I would prefer books writen by someone with years of C programming
experence, who knows the subject deeply. I would also prefer a book
that gives good examples. I understand best by explainations followed
by good/realistic examples.

I hope this isn't asking too much...

This only addresses part of your question, but this is a book that
every professional or even serious C programmer should read.

Safer C: Developing Software for High-Integrity and Safety-Critical
Systems (The Mcgraw-Hill International Series in Software Engineering)
by Les Hatton
Paperback 256 pages (December 12, 1994)
Publisher: McGraw-Hill Publishing Co.
ISBN: 0077076400

It is either out of print or was never distributed in the US. You
need to order it from a UK dealer. I got mine from
www.blackwell.co.uk, and it took several weeks to arrive on this side
of the pond.

I first heard of it when ACCU voted it something like the most
significant book on C (hopefully excepting K&R!) of the 20th century.

Hatton's work is the basis for much of the MISRA C standard, for
example.
 
C

Chris Barts

However malloc() and free() may be disallowed, which totally changes the way
most C programs are written.

I agree that disallowing dynamic storage would alter the structure of
almost all nontrivial C programs, but I'm at a loss to understand why one
would do so, or how one would make up for the crippling effect of no
longer being able to dynamically create data structures.

A VLA of user-defined structures might mitigate the loss of malloc(), but
one would be unable to create a linked list (for example), because one
would be unable to individually modify the creation of each element. Of
course, the foregoing assumes a C99 compiler (or a suitably nonstandard C
compiler of some description), which is hardly a portable assumption in
the real world.
 
F

Flash Gordon

I agree that disallowing dynamic storage would alter the structure of
almost all nontrivial C programs, but I'm at a loss to understand why
one would do so, or how one would make up for the crippling effect of
no longer being able to dynamically create data structures.

A VLA of user-defined structures might mitigate the loss of malloc(),
but one would be unable to create a linked list (for example), because
one would be unable to individually modify the creation of each
element. Of course, the foregoing assumes a C99 compiler (or a
suitably nonstandard C compiler of some description), which is hardly
a portable assumption in the real world.

I've done a lot of embedded SW development without the use of
malloc/calloc/realloc/free. I also know a lot more done in Pascal
without the use of dynamic allocation.

One reason the use of dynamic allocation and recursion were banned in
embedded code where I used to work was because we had to be able to
analyse the design (prior to coding) and estimate the maximum memory
usage (a normal requirement was 50% free memory on the initial version
to allow for later enhancements etc) and you had to be able to confirm
your analysis after coding.

It was not a problem because we were developing SW to deal with finite
and well defined amounts of data. For example, you know exactly how
large a frame buffer needs to be when doing video processing.
 
L

Lester Manry

Mike Wahler said:
I suspect there are good books about the above, but you're not
really asking about the C language, but about software design
and development methods (these issues would apply for any
language). So imo this isn't the place to ask. One place to
ask would be a more general newsgroup such as 'comp.programming'.

I'm not really all that sure what it is I'm looking for TBH. It
might not be specific even to programming. Perhapes something
of the form of turning an idea into something writable on paper,
that detailed enough to be refered to when writing a program in C.

Writing a program in any langauge without having some clearity on
on what it is you wish or need to create seems like a Bad Idea and
thats what I wish to avoid doing.
You might also find of interest the 'Extreme Programming' (aka
'XP') ideas: http://www.extremeprogramming.org/

So far this website appears to be in the right direction of the
type of information I'm looking for. Thanks :)
 
M

Malcolm

Chris Barts said:
I agree that disallowing dynamic storage would alter the structure of
almost all nontrivial C programs, but I'm at a loss to understand why one
would do so, or how one would make up for the crippling effect of no
longer being able to dynamically create data structures.
malloc() may be banned for performance reasons, or because it takes away the
configuration manger's control of memory. (The configuration manger is the
man who gives time and memory budgets to people, amongst other things). The
problem is that malloc() can fragment memory and fail unpredictably, which
means that programs which use it are hard to test. For an everyday app this
doesn't matter too much - if your 3d shooter doesn't fall over in 100 hours
of playtesting then it is reasonable to assume it is releasable. The same
doesn't apply to a cooling system control for a nuclear power station, or to
a life-support monitor for a hospital system, or indeed to an accounting
system for a big bank.
 
M

Malcolm

Lester Manry said:
Writing a program in any langauge without having some clearity on
on what it is you wish or need to create seems like a Bad Idea and
thats what I wish to avoid doing.
It can be a great idea. Start with "hello world" then add functionality as
and when your users require it, or you think you have something to offer.
 
L

Lester Manry

As others have said. comp.programming is more the forum for general
software design issues.

As soon as I have more info on just what it is I'm looking for I may
well take my question to 'comp.programming', or where ever it fits
best.
There are also hundreds of formal methods, all claiming to be the one true
design methodology. Usually these are advanced by ambitious people with
bullying personality, who see the personal advantage in being the authority
on software developement methods. Most methods suffer from trivial
weaknesses, the most usual one being that following the method imposes a
similar burden on the programmer to writing bug-free code at first try.

I'm not looking for anything formal really, just something in general
that usualy helps in getting a project from being more then just an
idea stuck in someone's head. Something open and generizlied ment
to be built-on based on personal preferences, with perhapes some
pro's and con's of some common practices.
However some are useful.
Which method to use depends very largely on the type of application you are
going to write. A quick utilty of no real importance - eg a program to take
an image, snip off the bordering pixels, and save the cropped image - can be
written "straight off" without any planning. Safety-critical code, on the
other hand, demands some sort of formal testing at the very least.

I agree with you and understand when something may or may not need
some form of planning to some extent, but not sure how to go about
comming up with a plan, which is what I want a book on. I've heard it
called a POA (Plan Of Action) which seems exactly what I need to learn.

Sort of. Obviously you have to have some idea what you are going to achieve
before you start any project. Some programs grow as functions undreamt of
are added, at other times you have a formal specification agreed with by the
client.

Yes sounds obvouse to me as well and what I choice to assume makes
any program a successful one. Some need no writing down cause of
there simpleness, yet other complex ones do for clearity which
then can be used as a guide.

I need some clearity before actualy writing some programs, and
thats where I get stuck. I need ideas for writing docs I can
use as a guide when writing my own programs. Like some programs
come with a TODO list which shows some attemp by the programmer
to give themself some clearity with what they wish to do. I
need a book that I can use as a guide in learning the planning
stage of the programming process.
This can be done, but is rather a mistake. An architect wouldn't decide "The
bridge must carry cars, a railway, and people. So I'll make it carry people
first, then add railway capacity."

I don't understand why. Maybe once I got a good book on the subject I will.

Seems to me to some degree you would. There are some things that would
overlap that might need done at around the same time. An architect would
need to decide those things in order to insecure the bridge supports people,
cars and a railway when the architect makes the bridge.

[snip]
Try

The Mythical Man-Month, by Frederick P. Brooks.
Code Complete, by Steve McConnell

There are also losts of books advocating the specific formal methods. We
don't use any of them in our working environment, so I'm not the person to
recommend.

I'll write them down and try to look at them next time I'm at a bookstore.
I'm not interested in some formal method just a general one so your
recommendations ought to be helpful to me :)
 
D

Dan Pop

In said:
I've done a lot of embedded SW development without the use of
^^^^^^^^^^^
malloc/calloc/realloc/free.

That's because this particular application domain allows a static
evaluation of the data memory resources needed, up to the last byte.

This is not the case for many hosted applications, where, in the absence
of dynamic memory allocation (e.g. traditional FORTRAN) you had to
overallocate memory and reject data sets too large for your statically
allocated arrays. Consider writing a compiler without using dynamic
memory allocation, for example. Your users will be "delighted" to see
errors like "internal symbol table overflow, please increase the SYMTABSIZ
parameter and rebuild the compiler".

I have actually used a badly designed C compiler that generated errors
like "internal symbol table overflow, please use option -FOO to increase
the table size". The developers either hadn't heard of realloc or were
too lazy to use it...

Dan
 
F

Flash Gordon

On 9 Sep 2004 12:22:37 GMT
In <[email protected]> Flash Gordon


That's because this particular application domain allows a static
evaluation of the data memory resources needed, up to the last byte.

I did say that, or something similar.
This is not the case for many hosted applications, where, in the
absence of dynamic memory allocation (e.g. traditional FORTRAN) you
had to overallocate memory and reject data sets too large for your
statically allocated arrays. Consider writing a compiler without
using dynamic memory allocation, for example. Your users will be
"delighted" to see errors like "internal symbol table overflow, please
increase the SYMTABSIZ parameter and rebuild the compiler".

I have actually used a badly designed C compiler that generated errors
like "internal symbol table overflow, please use option -FOO to
increase the table size". The developers either hadn't heard of
realloc or were too lazy to use it...

I was merely giving one possible reason for avoiding the use of malloc
etc since the previous poster seemed to think it was never appropriate
for real world programs. I was not saying it was always appropriate and
because of the type of SW I currently work on I make significant use of
it.
 
C

Chris Barts

I was merely giving one possible reason for avoiding the use of malloc
etc since the previous poster seemed to think it was never appropriate
for real world programs.

I didn't say it could never be appropriate, I simply said I didn't see any
scenarios where it would be.

I always develop for hosted platforms, not embedded, and I do not fully
understand all of the implications of developing for embedded platforms. I
realize my ignorance, and I wouldn't presume to make such a baldfaced
statement.
I was not saying it was always appropriate and
because of the type of SW I currently work on I make significant use of
it.

And I was saying that I could not imagine being without malloc on any of
the systems I design for.
 
F

Flash Gordon

I didn't say it could never be appropriate, I simply said I didn't see
any scenarios where it would be.

OK, so I miss-read what you wrote.
I always develop for hosted platforms, not embedded, and I do not
fully understand all of the implications of developing for embedded
platforms. I realize my ignorance, and I wouldn't presume to make such
a baldfaced statement.

See above.
And I was saying that I could not imagine being without malloc on any
of the systems I design for.

I've also done plenty of hosted work in Pascal that did not require
dynamic memory allocation, and would not have required it in C. The
largest amount being a computer (hosted system) controlling test
equipment to do automatic testing. Due to the way the tests were
designed we always knew exactly how much data we would be dealing with.

as you (correctly) say, it all depends on the systems you are designing
for.
 

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,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top