- The source is stored in a database.
- The program is presented in a book-like structure of modules (chapters), sections and units. The units are the actual program (procedures, functions, variables, objects, methods, ...); the modules and sections bring order to the collection of units.
- Holon keeps track of changes.
RemarksStoring source in a database makes sense, particularly if a program consists of a large number of units. (The number of units depends on the size of your definitions. If you don't mind writing procedures that span a printed page or more, you are probably better off with text files and a fancy editor.) I prefer many short definitions. Small procedures are simple to write, simple to read and understand, simple to test, simple to change. And: if I store the units in a database, it is a simple matter to keep track of the multitude and to implement useful features for efficient program development.Handling source in a database is not new, of course. It is common in OO systems (Smalltalk and others). It is used in the powerful Tcl introspection tools and development systems, which work on the internal database in Tcl. Isn't this general: Every modular program is turned into a database as soon as it is converted to code (interpreted/compiled). I keep wondering: Why is source still handled on text files? Are there any real advantages, or is it a matter of software folklore?Lars H, 2007-07-15: Community inertia is probably a major factor in this, but I can think of at least three reasons why text files are good:
- Long-term readability
- Source as a text file remains readable, even after a long time has passed -- programs written 30 years ago can still be read, even if modifications may be necessary to make them run again. How old is the oldest database you can read? How many other programmers do you know that can read it?
- Programs as literature
- The central thesis of literate programming is that programs are not just written for computers to run, they are also written for programmers to read. The program as a collection of text files can provide a narrative structure (even if that is in practice often just a random jumble) that by default would be absent from a database. On the other hand, Knuth's WEB system for literate programming is to some extent an in-text-file database of program fragments.
- Tcl philosophy
- Everything is a string, so what format could possibly be more suitable for a Tcl program than a text file?
- If you want to handle 30 year old programs you better store the source on paper, probably the only medium that you can still read. We can print database records as well as text files.
- Literate Programming is more likely an argument for source in a database, as you hint to yourself. E.g. Knuth's METAFONT program consists of numbered program pieces, each with a description (comment) and the source code (ready to tangle). This is also the format used in Holon. And, as in Holon, you can order and present the program fragments in the 'narrative structure' of a book.
- Tcl strings have identifiers/names, otherwise they are probably not very useful. Thus your Tcl program consists of a collection of similar items, and a database looks like a good place to store collections, at least as suited as text files, I think.
HZe 2007-Aug-04: One benefit of text files could be a source code management system (like CVS, Subversion) that allows to work on those files by many people and handle multiple changes on the same file. Is it possible to work on a Holon database simultaneously by several developers? The description seems to indicate that this isn't possible, the source management seems to be limited to the one working with the database.DKF: FWIW, subversion can work with binary files too, but in that case it's entirely up to you to figure out how to do the merge...wej: Holon is not meant for team work in its present form, I have developed Holon as one programmer's personal tool. But I see no principal reason why the concept can't be expanded to a multiprogrammer environment. The simplest solution is to break down your great project into a set of weakly dependent one programmer jobs... Sometimes it is possible.