Hi,
Antti wrote:What do you think?
I think it's a little similar to what I'm doing. The main problem is that existing tools aren't designed for it; and you really do need different tools designed to do it well (including IDEs/editors, compiler and languages).
Let's look at some of the disadvantages people have mentioned (and some I made up myself)...
"It's harder to find something". True, but only for crappy "plain text" development environments and crappy languages that allow things to be spread everywhere. Antti already suggested an IDE with a "tree-like view of the program" to solve the first problem. The second problem is actually caused by using multiple files in languages like C, where you have to use headers to make it work (and end up with some things in the code and some things elsewhere in headers). A different programming language can avoid this problem (e.g. it's not a problem for languages like Java).
"It enables several developers to work on the same code base at the same time". True, but only for crappy "plain text" development environments. With tools designed for it, nothing prevents you from having something like (e.g.) multiple "front end" clients that all talk to a common "back end" service. This approach may actually be far superior; as it allows things for things like "remote peer programming" (e.g. 2 programmers in different countries who are chatting via. something like
TeamSpeak and working on the same code together); while also allowing lone developers to "lock" pieces of source code while they work on it alone.
"It complicates version control". True, but only for crappy "plain text" version control systems. With tools designed for it (e.g. multiple "front end" clients that all talk to a common "back end" service) there's no reason the "back end" service can't store previous versions.
"It makes it hard/impossible to build different parts of the code base with different compiler and/or linker options". True (at least in some cases), but is this really a good thing? I'd suggest it's better to figure out which problems developers are trying to avoid by using different compilers and/or different linker options and fix those problems instead.
"It can make build times worse". To be honest; I'm not sure that this is true and I suspect it depends on which language, which optimisations and which linker. For example; as soon as you attempt link time optimisation this argument falls apart. In any case, for end-users (e.g. everything needs to be compiled when the executable is installed) a single source file is faster.
"It makes it hard/impossible to reuse code". True, sort of, but it's more complicated than that. The problem isn't code reuse (almost everything supports "copy and paste") but maintaining that reused code afterwards. For example, if a piece of code is used by 100 different/separate projects and you find a bug in it, then you'd want to be able to fix the bug at some central point rather than having to track down the 100 different/separate projects where it's been reused. However; the opposite is also true - if someone creates a new bug in a piece of reused code (possibly including deliberately inserting malicious code), then you don't want that bug to be automatically propagated into 100 different/separate projects where the code has been reused. What you really want is a way for the developers responsible for each of those 100 different/separate projects to be automatically notified when an update to the reused code is available, and to allow those developers to check the changes and decide whether to accept the updated reused code or to continue using the existing/older version. In both cases (single file source and multi-file source) you need something more than what existing tools provide.
"Not having/needing build tools (like "autoconf") makes it hard to avoid platform-specific hacks". True, but it's far better to avoid the need for platform-specific hacks. This can be done by having standards designed by someone slightly more competent than a committee of schizophrenic monkeys that have been taking large quantities of
LSD. Sadly, this means avoiding a lot of existing tools and languages (those monkeys have been very very busy).
"Not having separate files destroys the concept of "file scope" in some languages and can make code maintenance harder". An example of this is static functions and static global data in C. The simple solution is to use a language that doesn't rely on "file scope"; or to modify the language to suit (e.g. "subsection of file scope"); and the end result of this is that normal compilers (e.g. GCC) won't be adequate.
Mostly what I'm saying is that existing tools are the only real problem with the single-source file idea.
Cheers,
Brendan