in Uncategorized

Catching MUMPS…

The first time I had ever heard of MUMPS (also known as the M programming language) it was in an entry on the awesome Daily WTF. After the first pass through the article, I assumed, like several other people, that MUMPS was a cooked up name for a language whose identity was being protected. However, one very helpful commenter wrote that the language did, indeed, exist and had not been anonymized. Recently, the PLNews blog announced that there had been a new release of an Open Source MUMPS compiler/interpreter system. Curious, for reasons of archeology, if nothing else, I downloaded the source and compiled it. Then the fun part: I started playing with this relic.

Mumps documentation is a little hard to find. I suppose that the mere fact that some can be found is, in itself, a small miracle. The only real guide (aside from buying a book; 40 bucks isn’t a bad investment if you are doing this professionally, but for the casual tinkerer it seems sort of ridiculous) that I found was the quick and dirty manual that came packaged with the compiler itself.

The language itself is not unlike BASIC (and, I assume, COBOL or RPG) in spirit. The familiar procedural idiom is highly visible when looking at snippets like

> set a=”foo”

> write a

foo

and is mostly interpreted (the manual indicates that, according to the M language spec, it is impossible to create a fully compiled M program that includes all the relevant features).

The most interesting feature of the language is none of its BASIC-esque glory, but the way it handles what are termed global arrays. Arrays in M/UMPS are, basically, multidimensioned hashtables. These themselves act like the arrays you would be used to if you have used PHP or Perl (as an interesting note along these lines, the $ sigil is basically the opposite of the one used in PHP, variables, or Perl’s scalar variables; it is used to, instead, denote functions). Once one uses the ^ operator to access “global arrays”, one is no longer simply working on the currently running script. Rather, this data is written directly to disk in a tree-like structure which is not unlike the representation used by modern database systems. In addition, basic set operators are included in the language.
It is this whole idea that interests me. In many domains, this idea would be either nonsensical, but for most business apps that is all we really do. We read the database, do some processing, and write it back out. This model goes completely out the window for such programs as Latrunculi or Ocean that I am working on right now, neither of which use a database.

However, as I indicated, virtually every business application on the planet has this core workflow, even if the operation is to chew up some data and spit out some pretty pictures. Where does this leave us? All programs are stored procedures running on the database (or, all stored procedures are programs at the main computer’s level; however you want to see it). Now, there has been a great deal of talk about keeping all of the database layer in and of itself. This method of doing things seems to have, by and large, been passing in favor or using prepared statements in the main application code, eliminating the middle man of stored procedures. For better or worse, this makes the whole idea of separating a database intensive application (which is what every tracking, accounting, or point of sale system really is) more or less superflous. Alex of the Daily WTF even wrote an article on this subject. The reason why the line between the business rule layer and the data access is so blurry is because the line itself is really nonexistant. Business rules are little more than a description of what data we want to retrieve and what calculations we want to run.

I wonder whether a language like M might not have a place in today’s world. Replace the BASIC side with something more reminiscent of Python, Lisp, or Haskell and you might very well have a winning platform. Probably with a friendly ALGOL like syntax (making it more like JavaScript or ActionScript than any other language I have mentioned so far). Like I said, not applicable for everything in the wide old world, but a language like this would fulfill a wide need. Of course, in addition to bringing the main language itself up to date with such goodies as lambda expressions, the database backend itself would need to be overhauled to support finer grained querying, concurrency, clustering, and replication. Oh, well. All part of being a “programmer archaelogist”.

Write a Comment

Comment

To create code blocks or other preformatted text, indent by four spaces:

    This will be displayed in a monospaced font. The first four 
    spaces will be stripped off, but all other whitespace
    will be preserved.
    
    Markdown is turned off in code blocks:
     [This is not a link](http://example.com)

To create not a block, but an inline code span, use backticks:

Here is some inline `code`.

For more help see http://daringfireball.net/projects/markdown/syntax

 

  1. Having a hierarchical DB built into the language is the one redeeming factor, although it doesn’t have data integrity built into it.

    In any mainstream language is there an equivalent builtin data type that does some like this?

    set person(“USA”,”Florida”,”Leon”,”Tallahassee”,”Mike”)=1

    Before the above statement there is no need to declare the variable, person, or the structure of the variable.

    To put Mike in an index of people in Florida you would do this:
    set state(“Florida”,”Mike”)=1

    The syntax is quirky but once you’ve been using for a while it is easy to write and read MUMPS.

    A loop that prints numbers 1 to 10 is like this:
    for x=1:1:10 do
    . write x,!

    A conditional statement looks like this:
    if x do
    . write “yes”,!
    else do
    . write “no”,!

    The two spaces after the else are necessary.

    The do command and the dots make it possible to write the loops and conditional statements on multiple lines.

    I wouldn’t mind Python-like syntax but the archaic syntax becomes second nature eventually.

  2. @M –
    “In any mainstream language is there an equivalent builtin data type that does some like this?”

    In PHP, you can do something like the following (without having declared anything before):

    $a[‘a’][‘b’] = 1;
    echo $a[‘a’][‘b’];

    which will print 1.

    “although it doesn’t have data integrity built into it.”

    In my theoretical language, this would be the first thing added. 🙂

    “I wouldn’t mind Python-like syntax but the archaic syntax becomes second nature eventually.”

    True enough.

  3. Your discovery of Mumps is indeed timely. It’s actually in rather more use than you’d have guessed, particularly in healthcare and financial services. I’d suggest you check out my recent blog at http://www.outoftheslipstream.com/node/125 as a starting point which echoes many of your points. We were demonstrating its use at the recent AjaxWorld conference in San Jose, as proof of your thoughts that it could have a significant place as an Internet-scale database.

  4. I have been working with MUMPS (M) since 1971. I worked with the two MIT graduates that created it. Basically, M has always been way ahead of its time. The so called killer app for M has been demanding health care and financial applications where it has proven itself over the last 40 years – that’s why all US military personnel, Veterans and Native American’s medical records (to list a few) continue to be stored on M databases. A new killer app has evolved called the Internet. It appears lots of organizations are now recreating the M wheel (SimpleDB, CouchDB, etc.). As someone who spent a big part of his career teaching the technology and evolving it to Objects, I can attest to the fact that some people just never got it. Those who did could not understand why anyone would want to use any other database technology.

  5. The whole IT world has been brainwashed by the RDBMS and SQL meme for the last 25 years. RDBMS is founded on sound principles but it is completed neutered by SQL which is the most unstructured, awkward and unmaintainable language I have ever encountered.

    The Internet has introduced a problem domain that is not easily addressed by traditional RDBMSs. That of very large scale database applications which require flexible and rapidly evolving schemas. The response to this shortcoming has been the emergence of home grown technologies such as Google’s Big Table, Facebook’s Haystacks and others. Even the Drizzle project is trying to rip out the worst of MySQL’s bloat to make it usable at the Internet scale.

    The database concepts in Mumps have been dealing with all these problems for many years and is a very mature and well thought out solution to the problem of large scale databases with complex schemas that need to change and evolve rapidly. Its a perfect fit for the needs of today’s Internet applications.

  6. You can link databases on Perl to hashs with the tie () interface. Perl has many of the features you indicate built in already. MUMPS. despite the DailyWTF article, MUMPS is actually not a bad language. Some of the programs written with it are horrific but thats a problem with the coding style. You can write bad code in any language. The languages features such as dynamic types, creating variables dynamically, storing routines in variables and so on are not bad features. They are also found in languages like LISP. One can write perfectly readable code in MUMPS.

  7. @George, rightly said RDBMS have no answer to the internet produced problems,

    You can’t use rigid RDBMS data model for internet apps. apart from simpleDB another very interesting database is the Poseidon database, its a schemaless database, bundled with Brainwave development and deployment Platform. http://www.brainwavelive.com/

    Syd.

  8. Although I wrote my last Mumps program (“MIIS” dialect) 25 years ago, I remember the language fondly. In its heyday it provided an integrated operating system, database, programming language, and editor in one remarkably efficient package. We used it to build systems supporting 20-30 simultaneously active users on a PDP-11 or Data General Eclipse minicomputer – 16 bit computers with perhaps 256KB bytes of memory.

    One small correction to the article is that you shouldn’t use the word “hashtable” to characterize the data structures. The structures were B-trees, which provided both associative memory (like hashes) and key ordered sequential access (unlike hashes). The way that keys were parsed for tree traversal was one of the many interesting, clever, and truly useful features of Mumps.

    Is Mumps obsolete? Well, yes. But I think it was an important advance when it was first created in the early 1970’s.

  9. Hello everyone,

    I wonder why would anyone say that MUMPS (M) is obsolete?

    It is a technology that has been building up to what it is today for almost 40 years. It has always looked like XML internally (before XML existed) and its made of the stuff that all commercial Databases are made of internally (b-trees).

    When comparing languages and technologies is it not the age, maturity, flexibility, and experience that counts? Why do we have testing if its not to proof that a language and application can and has the ability to deliver. If MUMPS did not deliver don’t you think that the market forces would have killed it by now?

    Someone wrote that MUMPS is not capable of handling parallel processing which I beg to differ. Mumps has been successfully used in
    parallel processing algorithms in the past. In fact, if any one looks at the original C-Linda programming language you can see the incredible resemblance of C-Linda tupple-space to MUMPS globals!. I challenge you skeptics out there to compare the MUMPS language key concepts to any new and existing language. I dare you compare how some technologies, which are thought to be new, have been in the MUMPS core run time environment for many many years. For example, when .Net finally came up with their Run Time environment we MUMPSters had an existng environment for years before Microsoft even understood they needed one for their languages.

    The fact is that MUMPS has already moved up to the cloud where it will live and carry everyone’s data for a very long time. In the future
    folks who appreciate ingenuity will extend this language to cater
    to the new information age – M will continue to move forward
    as it has done for 40+ years.

    Please check all the companies that use MUMPS as their back-end processing engine and you will find that all of them cite M as part of their competitive advantage – why is that?

    Have fund racing against M – we will be waiting for you.

    M-Programmer.

  10. Hi there,

    I just read your comments programming in Mumps, when looking for some assistance in programming in Perl. It is funny, I have been programming between approx. 1985 and 1992 in Mumps, Digital Standard Mumps (DSM). Mumps is an easy to learn language (I learnt it in just 2 weeks). It worked on just a APPLE IIa with a couple of terminals attached to it, as well as with a main-frame (the one I was working on finally). I heard from others working at a hospital, that they were using just one PC to hook-up 40 terminals under Mumps. In total they had 3 PC’s working and 1 spare.

    However I changed company in 1993 and unfortunately lost connection to Mumps. Is there anyone who could help to get back to Mumps (or “M”) programming preferably under LINUX.

    I do however still have an old book in PDF-form, “Computer Programming in ANS Mumps – self instruction manual for non-programmers” 9,5MB. Feel free contacting me at jean-wolf@orange.fr

    Best regards

    Wolfgang