Re: organizing lisp code
- From: JesusWaffle@xxxxxxxxx
- Date: 30 May 2006 14:02:39 -0700
Personally, I tend to organize my definitions into logical "modules,"
and put each in a file. There are three guidelines I use to decide what
a module is:
1) The definitions inside a module are usually fairly closely coupled.
Generally, it consists of a few classes, which are often related by
containment or inheritance, and some functions/methods which operate on
those classes.
2) The definitions, when taken together, form a coherent,
information-hiding interface. Unfortunately, as far as I know, there is
no language support for deciding which definitions are interface, and
which are implementation: Common Lisp only has packages, which aren't
fine-grained enough to give one to each module. Some programmers prefix
their "private" symbols with % signs or the like.
3) Once I've split my code into modules, I can make a dependency
ordering on them. I can say, for instance, "module C only uses
definitions from modules A and B, and module B only uses definitions
from module A." I try to organize the modules so that each module has
as few dependencies as possible, and I avoid circular dependencies like
the plague. If you have a circular dependency, it almost always means
that you should move some definitions around, or split off the
troublesome definitions into a separate module.
Hope that helps!
Nick Thomas
.
- Follow-Ups:
- Re: organizing lisp code
- From: liyer . vijay
- Re: organizing lisp code
- References:
- organizing lisp code
- From: liyer . vijay
- organizing lisp code
- Prev by Date: Re: Just can't hear enough about Cells?
- Next by Date: Re: If you get Dr. Dobb's ...
- Previous by thread: organizing lisp code
- Next by thread: Re: organizing lisp code
- Index(es):