Home > Articles > Web Development > Perl

  • Print
  • + Share This
Like this article? We recommend

Like this article? We recommend

Lessons Learned

Why should you care about the story of BRP/P and its users? Even if you were hired into the company in which this story takes place, you would probably never encounter BRP/P—it lives in its own remote little universe, tended to by a small and dedicated user base mostly unknown to the rest of the world.

However, I think there are a number of interesting lessons to be learned or demonstrated by this anecdote. These lessons are generally applicable, and we would do well to internalize them, lest we inadvertently end up building the next BRP/P.

Interactivity Leads to Iterative Use

In many ways, BRP/P is such an interesting case study because it is based on totally different assumptions than the standard Unix (or Unix-inspired) working environment we take for granted today.

Basically all forms of interactivity are missing. Not only is all output directed to files but there is also no way to communicate even tiny bits of information (such as filenames) to BRP/P outside of a full BRP/P program. Taken together, the effect is almost deadly; the absence of instantaneous error reporting in particular was surprisingly painful.

It does make sense, however, when we imagine the original situation that BRP/P was designed for: Cards were punched, fed to the machine, and (much later) a new set of cards was generated as output. Keeping logs and results in separate stacks of cards makes sense; you also wouldn’t expect the system to shred the (paper!) cards from the previous run—it just generates a new stack.

Although on modern hardware, turnaround time was almost immediate, the characteristics of the environment still strongly influenced the way programmers interacted with the system. There was little exploratory programming, and people tended to develop narrow, specialized skills. Since it was so hard to get a new program up and running, existing programs would be tweaked forever. And a lot of time was simply spent on routine operations.

I think there is a hidden cost here to take note of(besides the obvious lack of efficiency): namely, the "opportunity cost." By discouraging exploratory, interactive programming, the environment discouraged people from thinking "outside the box" and to explore new ideas. What you saw was all you got.

Data Formats: Extensibility and Flexibility

Something we haven’t talked about at all yet is the format of the result (.OUT) files. These files were intended for humans, and so were nicely formatted reports, with tables as rows and columns (even with some ASCII art to delimit different sections). It looked quite nice. But it made any attempt to do anything with BRP/P output almost impossible—be it to do some post-processing via a Perl script or to generate a graphical display using a plotting program. There seems to be a rule: "Data formatted for humans will stress a computer to the breaking point." (And vice versa, as the Obfuscated C Code Contest demonstrates—human pattern recognition and computer language parsing are entirely different activities!)

Again, in the ’60s, it may have been a great service to provide a printed report as output, rather than a stack of punch cards. And in an environment in which interactive and therefore iterative programming is impractical, there is little lost in discouraging the use of the previous run’s output as input to the next. But on a modern Unix workstation, the cost of this assumption is high.

It’s the old story again of presentation and contents. The .OUT files forced a certain presentation on the contents, thereby making other uses of it almost impossible. Any form of mark-up format (even in its simplest incarnation, namely TAB-delimited!) would have left the choice of interpretation of the data to a separate program—be it human-readable rendering or any form of programmatic post-processing. Hard-wiring this choice into the main program itself severely limited the capability to do unexpected things with the results.

Mark-up has its own costs, among them the need for proper tools. The most important one is a good, interactive, and truly ubiquitous viewer, be it a web browser or groff. Note how BRB/P’s archive files would have been much less of a hassle if a viewer had been provided!

Good Design Is a Barrier to Entry, or: "Don’t Be Afraid to Get It Wrong"

Given the enthusiastic reaction with which doBRP was met by the BRP/P users, I found it odd that nobody had come up with a similar idea before. For some of the BRP/P operators, the reason was clear: they had never seen anything but BRP/P in their lives and therefore had neither the vision nor the (programming) skills to conceive of something different. But some members of the group had previous experience in programming, not so different from mine. Why didn’t they come up with a similar tool long before me?

One member of the group, for example, was an experienced Unix user and adept Python programmer who was suffering mightily under BRP/P’s shortcomings and later kicked herself for not coming up with the idea herself. Why didn’t she? At the risk of inviting a lot of controversy, I believe the answer lies (at least partially) with Python—specifically with Python’s attitude that "There should be one—and preferably only one—obvious way to do it."

The problem, of course, is that "the way" may not be obvious at all—particularly at the very beginning of a new, ad-hoc, exploratory project with an indeterminate value proposition. In such a situation, I want as many ways of doing things as possible, to keep the barriers to entry low to the point of being nonexistent. From my experience, I find that Python always requires a certain amount of up-front planning, which is certainly good on a larger project or when I know what I am doing. But it does impose a start-up cost.

I think there is a very important corollary to this observation: When doing something new, don’t be afraid to get it wrong! Once the idea shows sufficient promise, the case can be made to invest more resources to get it right. Attempting to get it right on first pass is not likely to be successful and stifles innovation. (This is an application of Fred Brooks’ dictum: "Plan to throw one away—you will, anyhow.")

And another corollary is the statement that in computing, as in much else, the larger the toolbox, the larger the set of problems one considers solvable.

Even a Trivial User Interface Requires Thought

I spent a long time thinking about the user interface to doBRP, in particular once I combined the two functions of 1) running a BRP/P program, and 2) viewing a BRP/P archive into a single tool. This may seem ironic, since the entire "User Interface" of doBRP consisted of its command-line arguments!

In a first version, I had the user indicate which mode he or she wanted to operate doBRP in (run or view) by specifying a flag, such as -r and –v, for instance. But that never seemed right. The mode was always obvious from the context: run a program file; view an archive file. So, I did away with the flag and had doBRP figure out the mode from the extension of the filename provided (a useful naming convention was already strictly adhered to —otherwise, I would have attempted to determine the filetype from the first few bytes). Hence: "Don’t make the user provide information that the system already knows" (Rick Lemons, after "More Programming Pearls").

I also wanted to give users the option to limit both the number of rows and the choice of columns when showing the contents of archives, again without having to specify a bunch of pesky command-line options (for example, -n 50 -f archive -k1 -k2, and so on). In the end, I avoided the need for most command-line flags by enforcing a particular order on the arguments: If the first argument was numeric, it was interpreted as the number of rows to print. The first non-numeric argument was interpreted as the filename, and all subsequent arguments were interpreted as column names. (If the numeric argument was missing, a default value was used.) Finally, there also were some "real" command-line flags, starting with a hyphen, for less-commonly-used options. If they were present, they had to follow the doBRP command immediately (standard convention). So the user interface could be made simpler and smaller by doing the following:

  • Anticipating the most common uses
  • Exploiting the natural format of the input (numeric, filename extensions)
  • Following the user’s thought process (first the filename, then the column names)

In a way, it is surprising that even the user interface of a simple, text-only tool actually offers any design choice at all! But it does. Having some user interface is easy; having one that makes sense is harder. The most absurd example of a user interface with no thought given to its suitability was a program that expected input of a wall-clock time as seconds since midnight UTC! That may be fine if the potential users are programmers themselves, but which was most definitely not true in this case.

I think in the quality of interfaces (user interfaces and APIs) one can see the true values of an organization: are people going the extra mile to anticipate future uses and failure cases, or are they satisfied with the next best thing? Do they exchange developer time for user time (and potentially, clean-up required because of bad user input)?

  • + Share This
  • 🔖 Save To Your Account