code reading

S

sabads

Hello all:
I'm a student learning procedure-oriented programming(use C). I want to
read some smart programs that perform important aspects of structure
programming.so I'm eager to obtain some advices about such codes? BTW,
the best are middle-scale and not too complex. I'm willing to elevate
my design level of procedure-oriented programming by reading code.
Thank you.
 
C

Cong Wang

sabads said:
Hello all:
I'm a student learning procedure-oriented programming(use C). I want to
read some smart programs that perform important aspects of structure
programming.so I'm eager to obtain some advices about such codes? BTW,
the best are middle-scale and not too complex. I'm willing to elevate
my design level of procedure-oriented programming by reading code.
Thank you.
I recommend the book "Code Reading--The Open Source Perspective" to
you!
It is very good!More info about it is:
Author:Doimidis Spinellis
Publisher:Addison Wesley
ISBN 0-201-79940-5
Most of the code in it is written in C.Enjoy it!
 
M

Malcolm

sabads said:
I'm a student learning procedure-oriented programming(use C). I want to
read some smart programs that perform important aspects of structure
programming.so I'm eager to obtain some advices about such codes? BTW,
the best are middle-scale and not too complex. I'm willing to elevate
my design level of procedure-oriented programming by reading code.
Thank you.
The methodology is called "structured programming". In contrast to
object-oriented programming there are few books on it. This is partly
because it is much simpler to master, which is a strength not a weakness.

Basically the program should form a call tree (C as good as imposes this
requirement on you) with each function having only one point of entry and,
arguably, one point of exit.

As you move down the hierarchy, functions should become simpler and more
general. Each function should be short ebough for a human to understand, and
should do one clearly-defined task, whether that is "pilot ship to Mars" (a
high level function) or "calculate distance between two points" (a low level
function the first will probably call).

There should be few or no global variables. There should be no jumps between
functions, strictly speaking you shouldn't have function pointers either,
though this requirement isn't usually very useful.
The structure shouldn't degenerate into a list (all functions called
directly from main) or a pole (each function called from the other). It
should be a roughly balanced tree.
 
G

Giorgos Keramidas

Cong Wang said:
sabads said:
Hello all:
I'm a student learning procedure-oriented programming(use C). I want to
read some smart programs that perform important aspects of structure
programming. [...]

I recommend the book "Code Reading--The Open Source Perspective" to
you!

It is very good!More info about it is:

Author:Doimidis Spinellis
Publisher:Addison Wesley
ISBN 0-201-79940-5
Most of the code in it is written in C.Enjoy it!

FWIW, the author's name is ``Diomidis Spinellis''.
I'll agree It's true that this is a great book :)

- Giorgos
 

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
474,167
Messages
2,570,911
Members
47,453
Latest member
MadelinePh

Latest Threads

Top