Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!uunet!tdatirv!sarima From: sarima@tdatirv.UUCP (Stanley Friesen) Newsgroups: comp.unix.misc Subject: Re: software organization Keywords: software module organization function Message-ID: <243@tdatirv.UUCP> Date: 4 May 91 17:33:52 GMT References: <1684@babcock.cerc.wvu.wvnet.edu> Reply-To: sarima@tdatirv.UUCP (Stanley Friesen) Organization: Teradata Corp., Irvine Lines: 31 In article <1684@babcock.cerc.wvu.wvnet.edu> abmg@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)