Tuesday 23 May 2006 — This is over 18 years old. Be careful.
I’ve noticed a pattern in software systems: secondary channels into the guts of the software are implemented as fake objects from the primary channel. That’s a horrible sentence; let me demonstrate with a few examples:
- In Linux, you can find out about the current status of much of the operating system by reading pseudo-files in the /proc pseudo-filesystem.
- In many database systems, you can find out about the dynamic status or static structure of the database by querying pseudo tables, such as MySQL’s INFORMATION_SCHEMA database.
- Printers have self-tests that result in a page being printed containing statistics and configuration of the printer.
I know in my own work, I often have need to create a way to get into the internals of the software, either to change configuration or to get debugging or administrative information out. If the product is in the business of serving information (such as a web application), it’s straightforward to add a URL which serves the information desired.
With dynamic web applications (the word dynamic is an oxymoron at this point!), there’s practically no cost to adding another URL running another piece of code. It’s almost not even worth noting that we can create URLs to serve not just our customers, but ourselves.
I’m wondering what other more exotic examples there are out there of machines producing pseudo-products as a way of communicating with the outside world? What’s the most creative use of this technique?
Comments
For example, while working on my latest webapp (using Python's CherryPy framework), I needed a way to inspect running code. The "obvious" solution was to make a web-based Python read-eval-print loop (http://projects.amor.org/misc/wiki/HTTPREPL); since I already had the framework running, it was an easy choice to leverage it. Not always the best choice, mind you, but the easiest.
I'm not sure if that's the same idea or different from fake objects. It's like how GNU Screen captures certain extended terminal escape codes, while letting other codes bubble up to the actual terminal.
Other techniques might be things like a dictionary/associative-array-like objects, that watch how they are accessed. Which is kind of a decoration pattern.
Add a comment: