software organization

Stanley Friesen sarima at tdatirv.UUCP
Sun May 5 03:33:52 AEST 1991


In article <1684 at babcock.cerc.wvu.wvnet.edu> abmg at cathedral.cerc.wvu.wvnet.edu (Aliasghar Babadi) writes:
>Hi,
>	I have some questions regarding software organization:
>
>	1- What is a module and how do you describe it?

A module is a group of closely related routines and the data associated with
them.  I tend to use a rather object oriented view, where the data set is
central, and the module contains all routines authorized to operate on it.

>	2- What is the best way of organizing your code?

Generally, I create sets of routines that cooperate to manage a resource
or provide a service.  I make an effort to make all variables have the
smallest scope usable.  That is, when writing in C, I use function scope
where possible, then I switch to file local scope, and only go to true
globals if I cannot find a way to access the data reasonably at file scope.

I apply the same criteria to routines.  I only export the public inteface
routines, the others are given local scope.

>	3- Is it a good practice to keep each function in a seperate file?

Only if writing a large general purpose subroutine library.  Otherwise
a form of function decomposition is more useful.  That is in most cases
I place one module per source file.  But, if the module is particularly
large, I may split it into two or three files on the basis of some subset
of the functionality.
-- 
---------------
uunet!tdatirv!sarima				(Stanley Friesen)



More information about the Comp.unix.misc mailing list