Programming languages like Ada and C++ have many features to try make it feasible for teams to write large systems. Oberon relies heavily on the MODULE construct for this, and more importantly on a culture of avoiding large systems where possible. Here are collected some small pieces of software that I found useful for development in the Oberon environment.
Files often contain two modules, one for the implementation and one for a unit test. I owe this to examples on the Astrobe forums.
The first thing is a simple debug output library.
PO2013 doesn't have an interactive source-level debugger (I don't find these very useful anyway).
The book mentions a backtrace feature on traps, but I can't find that.
This code is similar to the C technique of sprinkling
printfs around, with the following small improvements:
- You can disable all output for a particular facility in one place. This is at run-time, it would be nice at compile-time but this would require something like the macro processor from "Software Tools in Pascal".
- Expensive operations (e.g. decimal numeric output, floating point) are avoided. This doesn't really matter when we have Texts.Mod, but the interface could be useful for more resource-constrainted targets.
Finite State Machines
Secondly, I wrote some code to implement finite state machines. It may be a matter of taste, but I prefer to structure software as cooperating FSMs when possible.
Finally, I wrote a unit testing library that