Project

General

Profile

Design #1783

Code & doc structure: one-big-file or many-small-files?

Added by John Abbott 2 months ago. Updated 2 months ago.

Status:
In Progress
Priority:
Normal
Assignee:
-
Category:
Tidying
Target version:
Start date:
24 Feb 2024
Due date:
% Done:

10%

Estimated time:
Spent time:

Description

I'd like to discuss briefly the pros & cons of many-small-files and one-big-file. Currently the CoCoALib code is a mixture:
  • NumTheory.H is one-big-file (but the impl files are several)
  • SparsePolyOp-XXX is many-small-files (both headers & impls)

Can we establish guidelines/recommendations (for code & for doc)?


Related issues

Related to CoCoALib - Support #1672: Documentation: a good model to follow?New2022-03-15

Related to CoCoALib - Support #1510: Documentation for SparsePolyOps?New2020-10-14

Related to CoCoALib - Support #1265: Unregistered TXT files in docClosed2019-03-27

History

#1 Updated by John Abbott 2 months ago

  • Status changed from New to In Progress
  • % Done changed from 0 to 10

Thoughts about one-big-file vs many-small-files:

For source code:
  • ASSUME many-small-files means many header files & many impl files -- could in principle have few header files and many impl files
  • compilation of many-small-files is likely easier on a computer with little RAM
  • compilation of many-small-files may be faster on a computer with many cores
  • recompilation after adding a new function is likely faster with many-small-files
  • changing an existing API (fn-name, or arg-list, or rtn-value) may involve editing many more files with many-small-files -- I would not expect much difference in recompilation time
  • with many-small-files it may not be obvious where the impl is to be found (or where a new impl should be placed, e.g. if it operates on 2 objets of different type)
  • with many-small-files the impl files will need to have more include directives (and it may take some effort to discover exactly which header files should be included)

It is not clear to me that the convention of structuring the header files
and impl files the same way is really a good idea; it is a natural idea,
and is quite possibly helpful for the developers. There is a connection
between fine-grained header files and "minimal recompilation" -- this surely
saves time for the developers.

For documentation:
  • CONVENTION: we have typically had a 1--1 relationship between header files and doc files (no doubt with some exceptions)
  • with many-small-files each doc file is shorter, and thus likely easier to digest -- though a well-structured big file might be just as easy
  • with many-small-files it may not be obvious in which doc file to look for doc about a specific fn -- this could be resolved by having a good search mechanism (JAA thinks the CoCoA-5 manual works pretty well)
  • with many-small-files there is possibly more need for xrefs (??)

It is not clear to me that the CONVENTION of structuring the doc files
the same way we do for the header/source files is really a good
convention. The convention is probably helpful for developers, but a
normal user probably does not care

#2 Updated by John Abbott 2 months ago

A brief phone discussion with Anna yesterday suggested a vague preference for many-small-files.
But no genuine reasons for the preference were stated.

#3 Updated by Anna Maria Bigatti about 2 months ago

  • Related to Support #1672: Documentation: a good model to follow? added

#4 Updated by Anna Maria Bigatti about 2 months ago

  • Related to Support #1510: Documentation for SparsePolyOps? added

#5 Updated by Anna Maria Bigatti about 2 months ago

Also available in: Atom PDF