Ex Base

Wiki re-wording for "XBase", which is a general term for languages and tools derived from the Ashton Tate dBASE product, popular in the 1980s and early 1990s. Clones include FoxPro, Quicksilver, dbXL, and a compiled dialect called Clipper (which spawned XbasePlusPlus, FlagShip, and Harbour). XBase originated as a table-oriented non-SQL language and tool vaguely influenced by relational theory and (mainly) cursor-oriented table navigation techniques from the 1960s. It was one of the first products that easily allowed small businesses access to database concepts such as ad-hoc queries, indexing, and data-driven CrudScreen RAD when microcomputers were just coming of age. Jim "Button" Knopf's "PC-File" exhibited similar capabilities, albeit with less programmability.

It allegedly has its roots in a legacy database product called RETRIEVE. The Pasadena Jet Propulsion Laboratory, famous for planetary probes, didn't want to pay licensing fees for RETRIEVE and so set out to create something similar. In a round-about way, it eventually wound up a commercial product for CPM microcomputers, and grew quite popular in the DOS world. Much of the history of the product was discovered during court testimony related to lawsuits by Ashton Tate to prevent clones of the product/tool. It turned out that Ashton Tate's view of history was not entirely accurate, and the history of ExBase was deeper than their original story.

Its demise in popularity has been attributed to one or more of the following:

Other products such as Visual Basic, Microsoft Access, Paradox, and PowerBuilder eventually replaced its niche. Some feel the XBase vendors should have expanded on its table-oriented nature and used ControlTables for event handling and GUI properties rather than try to copy OOP techniques popular in other GUI tools. An opportunity to go down a unique path was allegedly lost, and instead they tried to be a me-too product in an arena that was too different from the root table-oriented philosophy of the tool. You can turn a leopard into a tiger, but not into a gazelle. (FoxPro and VisualFoxPro actually use ControlTables for many GUI aspects, but it is generally an UndocumentedFeature.)

The language gives one the feel of being "inside" database tables. It is heavily context-based because of its interactive origins. The plus side of being context-based is that less code is usually needed to indicate what is being operated on, and it made it easy to learn and debug using the interactive mode. The downside is that if not used carefully in longer modules, it can cause great confusion.

An interesting feature is that iteration over a table was built into the language. A general form of the syntax is:
  do_x             // operate on current record
  do_x all         // operate on all records
  do_x for <expression>  // operate on records matching the expression
(Actually "&&" is used for comments instead of slashes, but that might confuse the reader here. Also, not all dialects allowed such on user-defined routines, but only built-in ones.)

If you needed the same filter on multiple operations, then FoxPro and some other dialects introduced the "scan" construct:

  scan for <expression>
    do_something
    do_something_2
  endscan
One could also apply a filter for multiple statements:

  use <table>    // open a table
  set filter to <expression>
  do_something
  do_something_2
  scan
    do_something_3
  endscan
  etc...
  set filter to     // turn off filter
Some might consider this approach inferior to "scope blocks" or closures of some kind because blocking would guarantee that the filter does not accidently "stay on" if we forgot to close it, but the XBase approach allows more interaction. You could use the same commands in interactive mode that you could in the programming code. Thus, with some copy-and-paste one could create a module out of their interactive session with only minor tweaks. One could also use a coded module to set up the environment, but then switch to interactive mode from that point on. That would be harder to do with scoped blocks because one must know the end-point ahead of time.

Early dialects required a fair amount of work managing indexes, but later dialects moved toward more automatic approaches where indexes were automatically opened and updated when a given table was opened or updated. Unfortunately, the newer approaches were not standardized. Generally the dBASE III+ dialect was probably the final version influencing a universal dialect. They diverged after that (although there was still some cross-borrowing). Thus, if one wanted to target multiple dialects, they usually stuck to III+ conventions.

Although many aspects of the language and tools are clunky, it has some interesting features that are hard to find in SQL-based tools. Many still consider it an excellent ad-hoc data transformation tool because it is usually easier to inspect intermediate steps and do incremental experiments with than with SQL tools. SQL has a more "batch" philosophy behind it.


Format Template Strings

One thing about ExBase that greatly simplifies writing the validation in CrudScreen applications is its format template strings. You didn't have to write a whole lot of validation code because the format string would guarentee the user entered only what the format would allow. For example, a phone number format template would look something like:

   "(999)999-9999 \xAAAAA"
Here "9" is for digits and "A" is any alpha-numeric char. The "\x" escapes the "x" for phone extension since "X" was also a formatting character. (The specifics may not be entirely accurate here, I don't remember the details.)

The templates appear to be roughly barrowed from Cobol's character templates. The Xbase cursor would not produce a character that was not allowed in a given position. Thus, if you typed a letter where a digit was expected, the cursor simply would not move (and beep in some dialects). The "marker" characters, such as the parentheses in the phone number helped the user know where to type. The cursor automatically skipped over the marker characters.

It is one of those intuitive, useful, and life-simplifying features that you really miss when you have to do it the hard way. I hope AjAx adopts them. Swing has added "JFormatted'TextField" that allegedly does something similar. Superficially it looks kind of limited.


Pro's

         && Loop and Update Example
         USE tableX
         SCAN FOR &myFilterCriteria
            IF x > y AND replacable
               REPLACE x WITH y
            ENDIF
            IF a + b < c
               REPLACE message WITH "Low"
            ENDIF
         ENDSCAN

Con's


Links

Appreciation site: http://www.geocities.com/tablizer/xbasefan.htm

Interview with creator: http://reddevnews.com/qandas/article.aspx?editorialsid=113


See Also: CollectionOrientedProgramming, PowerfulAdHocDataProcessingTools, ModernizingExBase, ExBaseRant
CategoryOldSoftware, CategorySoftwareTool

EditText of this page (last edited February 8, 2010)
FindPage by searching (or browse LikePages or take a VisualTour)