Re: Organizing code with CLOS



Jonathon McKitrick wrote:
Do you guys generally put class definitions and generics in one file,
and defmethods in another? Or lump them all together?


I do not write defgeneric unless I have to (non-std method combo).

Otherwise, sometimes methods go after their classes, sometimes they all go together in a separate file dedicated to a subset of the functionality built around the classes.

Elsewhere you asked:

My current project is steadily growing, and recent interest by potential customers has
made it pretty clear the growth is going to continue. I've found myself several times
readjusting directory layout, filenames, asdf, and so on.

Yes, upheavals are fun.

Learn about pathnames and even <gasp!> logical pathnames. That will let you mess with directory structure least painfully.


Is there a standard approach you have found that works well for organizing (within a
given module) code according to classes, macros, implementation, misc, utilities, and all
that? One that grows well, is easy to maintain, and works well with CL?

Divide the code into packages along whatever sensible functional lines you see, the sooner the easier. Each package gets its own subdirectory. If you have enough code, this will lead to refactoring because you will find using code requiring access to package internals. Not good. So you stare at it and extend the API so the using code can stay out of the package. Stuff like that.

Classes /must/ precede methods specialized on them, and macros must precede any use, so that gives you some clues.

Otherwise, I keep my source files small and just divide up functionality along sensible lines of grouping and do not worry about it much.

kt
.



Relevant Pages

  • Re: How inaccurate is a 555 or 7555 REALLY?
    ... on making a tiny quartz crystal divide down to 420hz in a tiny package ... Sine wave output preferred, but I think square ...
    (sci.electronics.design)
  • Re: rkhunter on Etch
    ... the overt functionality doesn't change, ... does (the refactored code is more secure, or less memory intensive, or ... Say package foo has a security issue and upstream is at 1.4 and Debian ...
    (Debian-User)
  • Re: Question about jumps
    ... I think some assemblers dump the symbol table with the listing file, which Nasm doesn't do... ... scale it down a good bit to make a "Linux NASM Beginner Kit" package. ... If "nasm64" ever appears, we'll want macros so ... mov rax, 1; maybe just eax? ...
    (alt.lang.asm)
  • Re: aclocal and hello world
    ... >> macros used in configure.ac. ... > into the autoconf package where they more properly belong. ... > seems to be part of automake, ...
    (comp.unix.programmer)
  • Re: aclocal and hello world
    ... > macros used in configure.ac. ... I've read somewhere, in a recent autoconf manual I believe, ... into the autoconf package where they more properly belong. ... Anyways, it's good that aclocal is outputting those warnings, cause ...
    (comp.unix.programmer)