[comp.unix.questions] Modularization

brnstnd@stealth.acf.nyu.edu (01/08/90)

In article <1990Jan6.233340.9978@smsc.sony.com> dce@Sony.COM (David Elliott) writes:
> Some people I have
> worked with like to put awk scripts in separate files.  To me, that's
> like breaking up your C program into separate binaries and exec'ing
> them as needed - it slows down the program and makes it harder to
> maintain.

Modularization makes programs easier to maintain if it represents a
clean break between separate functions.

I use just one program, pty, as the sole interface between other
programs and pseudo-terminals. Of course it requires an extra exec,
but my programs and shell scripts are much more portable. A different
system might implement pseudo-terminals as streams; the only program
that needs to change is pty. This makes the programs easier, not harder,
to maintain.

Similar comments apply to my tcp and attachport programs, which handle
everything that a typical Internet application needs. Most of my network
programs now don't know anything about TCP; they just talk to a few file
descriptors. This not only makes the programs easier to maintain, but
also makes it trivial to use the same protocol with several different
communications mechanisms. Actually, it's not fully modular yet, because
tcp and attachport don't understand OOB signals, but the principle is
valid.

---Dan