On 5/23/06, Craig Latta craig@netjam.org wrote:
It is a very good idea. A module is defined as all the code that is needed to run a test suite. To have a module, you must have tests. I like it!
Cool! I expect that there will be some fiddling with that delineation
(to deal with conceptual overlap, etc.), but that's more or less the idea.
The more I think about it, the better I like the idea of using tests to define module boundaries. A module depends on some other modules, of course. The other modules are loaded before the tests are run, so their code will not be counted among the code of the module. People can control the code in a module by changing its tests. The only problem would be code that is hard to test with automatic tests, such as an event loop. However, it should be easy for a test to explicitely list methods that should be included even though they are not called. Do you have a way of doing this already?
Good code needs tests. Encouraging people to write tests helps them to write better code. So, defining modules as "all the code covered by a test suit" will make the code better, because it ensures that it has at least minimal tests.
I also like the idea of implementing a module as the objects (classes and methods) that are traced during execution. I was at a workshop a few weeks back that included both Schemers and Smalltalkers. One thing that impressed me was that Schemers think a program is a text file, while Smalltalkers think a program is a set of objects in memory. There was one Lisp guy there, and he was more like Smalltalkers, because he thought of a program as a set of S-expressions, and the textual representation of S-expressions in files was secondary. Lisp is reflective; Scheme is not. In a reflective language, the internal representation of a program has computational meaning. So, Spoon is very much in line with the Smalltalk tradition, but in a way that will seem extreme to non-Smalltalkers.
Like I said in another message, I think you will have to deal better with class name clashes because the global variable Smalltalk is important. I think this will lead to name spaces in Spoon. I'll post another message about that later.
-Ralph