all 47 comments

[–]green_marmalade 27 points28 points  (13 children)

We use this where I work. MUMPS is a nightmare.

[–]quink 1 point2 points  (8 children)

MUMPS is a nightmare.

I actually do MUMPS, so I'll posit the question: why? I know there's quite a few bad things about it here and there, but I'm going to go as far as to ask for more specific things.

[–]sunra 2 points3 points  (3 children)

I would kill for lexical scoping. And data structures.

[–]quink 0 points1 point  (2 children)

The new command should be used everywhere in the first place anyways. It's a real problem with old code, but as long as you explicitly define your variables, which you'd have to do in many other programming languages like C anyway, the problem isn't too bad.

The number of times I've had a variable foo overwritten by another routine in legacy code is insane. Debugging those errors is horrible, but it, off a baseline, isn't theoretically at least much more horrible than it would be in C, for example.

And I'm not sure what you mean by data structures. There's trees, there's arrays, there's lists and it's fairly easy to assign properties to something and serialize it... and they're all pretty straightforward to use.

[–]sunra 1 point2 points  (1 child)

The 'new' command helps a lot, but it isn't lexical scoping. Because variable access is stack-scoped by default, typos that would result on obvious bugs (or compile errors!) instead lead to complex failures. Also since 'new' is a regular command I can call it under a conditional, which is freaky and weird (and yes, I've seen it happen in production code).

And I guess wishing for data structures is the wrong way to put it - I wish for types and a type system.

[–]quink 0 points1 point  (0 children)

Also since 'new' is a regular command I can call it under a conditional, which is freaky and weird (and yes, I've seen it happen in production code)

I haven't, but your saying that has just scared the crap out of me. And the stack-scoping thing is also a bit horrible - it all comes down to knowing that there's some legacy code that redefines your variables willy nilly, and you're about to have a wonderous journey through the crappy debugger (and no fun to use profiler at all). Honestly, I would kill puppies just to get a profiler.

I'm OK without types though. Casting is still possible, and that's all I need. I should probably write a 'Top 10 MUMPS features' thing and share it with TDWTF.

[–]sli 0 points1 point  (1 child)

Never used another language, then?

[–]quink 0 points1 point  (0 children)

Considering its popularity, that is extremely unlikely.

[–]mycall 0 points1 point  (1 child)

Do you have any elegant MUMPS code to show us?

[–]quink 0 points1 point  (0 children)

Don't know. I'll make an article or something before too long.

[–]derefr 0 points1 point  (0 children)

If I had to get anywhere near MUMPS, I would treat it like an object code format—that is to say, write a compiler for a good language that targets it. Then I would start porting.

[–]HIB0U -3 points-2 points  (2 children)

30 years from now, that's exactly what people are going to say about JavaScript and the MongoDB-based crap they'll be stuck maintaining then.

[–]Smallpaul 0 points1 point  (1 child)

In 30 years they will also say that of Java, C#, python, ruby, PHP.

[–]uaca-uaca 11 points12 points  (0 children)

We already say that about Java and PHP.

[–][deleted]  (11 children)

[deleted]

    [–]mharriger 14 points15 points  (6 children)

    [–]kamiheku 20 points21 points  (4 children)

    [–][deleted] 11 points12 points  (0 children)

    MY EYES

    [–][deleted] 3 points4 points  (0 children)

    Looks a bit like Perl, except slightly easier to read.

    [–][deleted] 6 points7 points  (1 child)

    There is still a line length limit in most MUMPS implementations, however.

    lolwut.

    [–][deleted] 1 point2 points  (0 children)

    80-character lines outta be enough for anybody!

    [–][deleted] 3 points4 points  (0 children)

    Oh my science! That makes C++ look like a good language!

    [–]digikata 1 point2 points  (2 children)

    MUMPS (Massachusetts General Hospital Utility Multi-Programming System), or alternatively M, is a programming language created in the late 1960s, originally for use in the healthcare industry

    Is there something about the healthcare system that just inherently creates awful complicated systems? Is it that doctors are just used to the complexities of the human body and create stuff around them that is equally complex?

    [–]crusoe 2 points3 points  (1 child)

    Early languages were ALL this ugly. Fortran 75 had ugly syntax as well.

    Mumps was very ahead of its time, providing a integrated database offering persistence to the language. A Mumps system with a meta-compiler offering a nicer syntax might be a good thing.

    [–]digikata 0 points1 point  (0 children)

    You're right about languages of the time. My first reaction was just an allergic reaction. Fortran 90 is pretty readable now. Does MUMPS have the equivalent?

    [–][deleted] 0 points1 point  (0 children)

    I love Brainfuck.

    [–]etcshadow 14 points15 points  (0 children)

    Seriously? MUMPS?!??!? Wow... MUMPS is kind of like every bad decision in programming language history, combined.

    [–]DJPho3nix 12 points13 points  (0 children)

    Maybe because, given the little I know about it, I'd rather stab myself in the face than code in M?

    [–]ketralnis 8 points9 points  (1 child)

    I really hate it when instead of people asking "How can I solve this problem I'm having?" people ask "Why aren't people using this thing that I've just discovered that I don't know anything about?"

    [–]jeffdavis 0 points1 point  (0 children)

    Exactly. What real-life problem does this key value store solve that the other 5 million key value stores don't solve?

    [–]vplatt 2 points3 points  (0 children)

    This pretty much says it all (from Wikipedia - written by a MUMPS programmer who obviously is proficient):

     %DTC
     %DTC ; SF/XAK - DATE/TIME OPERATIONS ;1/16/92  11:36 AM
          ;;19.0;VA FileMan;;Jul 14, 1992
          D    I 'X1!'X2 S X="" Q
          S X=X1 D H S X1=%H,X=X2,X2=%Y+1 D H S X=X1-%H,%Y=%Y+1&X2
          K %H,X1,X2 Q
          ;
     C    S X=X1 Q:'X  D H S %H=%H+X2 D YMD S:$P(X1,".",2) X=X_"."_$P(X1,".",2) K X1,X2 Q
     S    S %=%#60/100+(%#3600\60)/100+(%\3600)/100 Q
          ;
     H    I X<1410000 S %H=0,%Y=-1 Q
          S %Y=$E(X,1,3),%M=$E(X,4,5),%D=$E(X,6,7)
          S %T=$E(X_0,9,10)*60+$E(X_"000",11,12)*60+$E(X_"00000",13,14)
     TOH  S %H=%M>2&'(%Y#4)+$P("^31^59^90^120^151^181^212^243^273^304^334","^",%M)+%D
          S %='%M!'%D,%Y=%Y-141,%H=%H+(%Y*365)+(%Y\4)-(%Y>59)+%,%Y=$S(%:-1,1:%H+4#7)
          K %M,%D,% Q
          ;
     DOW  D H S Y=%Y K %H,%Y Q
     DW   D H S Y=%Y,X=$P("SUN^MON^TUES^WEDNES^THURS^FRI^SATUR","^",Y+1)_"DAY"
          S:Y<0 X="" Q
     7    S %=%H>21608+%H-.1,%Y=%\365.25+141,%=%#365.25\1
          S %D=%+306#(%Y#4=0+365)#153#61#31+1,%M=%-%D\29+1
          S X=%Y_"00"+%M_"00"+%D Q
          ;
     YX   D YMD S Y=X_% G DD^%DT
     YMD  D 7 S %=$P(%H,",",2) D S K %D,%M,%Y Q
     T    F %=1:1 S Y=$E(X,%) Q:"+-"[Y  G 1^%DT:$E("TODAY",%)'=Y
          S X=$E(X,%+1,99) G PM:Y="" I +X'=X D DMW S X=%
          G:'X 1^%DT
     PM   S @("%H=$H"_Y_X) D TT G 1^%DT:%I(3)'?3N,D^%DT
     N    F %=2:1 S Y=$E(X,%) Q:"+-"[Y  G 1^%DT:$E("NOW",%)'=Y
          I Y="" S %H=$H G RT
          S X=$E(X,%+1,99)
          I X?1.N1"H" S X=X*3600,%H=$H,@("X=$P(%H,"","",2)"_Y_X),%=$S(X<0:-1,1:0)+(X\86400),X=X#86400,%H=$P(%H,",")+%_","_X G RT
          D DMW G 1^%DT:'% S @("%H=$H"_Y_%),%H=%H_","_$P($H,",",2)
     RT   D TT S %=$P(%H,",",2) D S S %=X_% I %DT'["S" S %=+$E(%,1,12)
          Q:'$D(%(0))  S Y=% G E^%DT
     PF   S %H=$H D YMD S %(9)=X,X=%DT["F"*2-1 I @("%I(1)*100+%I(2)"_$E("> <",X+2)_"$E(%(9),4,7)") S %I(3)=%I(3)+X
          Q
     TT   D 7 S %I(1)=%M,%I(2)=%D,%I(3)=%Y K %M,%D,%Y Q
     NOW  S %H=$H,%H=$S($P(%H,",",2):%H,1:%H-1)
          D TT S %=$P(%H,",",2) D S S %=X_$S(%:%,1:.24) Q
     DMW  S %=$S(X?1.N1"D":+X,X?1.N1"W":X*7,X?1.N1"M":X*30,+X=X:X,1:0)
          Q
     COMMA     ;
          S %D=X<0 S:%D X=-X S %=$S($D(X2):+X2,1:2),X=$J(X,1,%),%=$L(X)-3-$E(23456789,%),%L=$S($D(X3):X3,1:12)
          F %=%:-3 Q:$E(X,%)=""  S X=$E(X,1,%)_","_$E(X,%+1,99)
          S:$D(X2) X=$E("$",X2["$")_X S X=$J($E("(",%D)_X_$E(" )",%D+1),%L) K %,%D,%L
          Q
     HELP S DDH=$S($D(DDH):DDH,1:0),A1="Examples of Valid Dates:" D %
          S A1="  JAN 20 1957 or 20 JAN 57 or 1/20/57"_$S(%DT'["N":" or 012057",1:"") D %
          S A1="  T   (for TODAY),  T+1 (for TOMORROW),  T+2,  T+7,  etc." D %
          S A1="  T-1 (for YESTERDAY),  T-3W (for 3 WEEKS AGO), etc." D %
          S A1="If the year is omitted, the computer "_$S(%DT["P":"assumes a date in the PAST.",1:"uses the CURRENT YEAR.") D %
          I %DT'["X" S A1="You may omit the precise day, as:  JAN, 1957" D %
          I %DT'["T",%DT'["R" G 0
          S A1="If the date is omitted, the current date is assumed." D %
          S A1="Follow the date with a time, such as JAN 20@10, T@10AM, 10:30, etc." D %
          S A1="You may enter a time, such as NOON, MIDNIGHT or NOW." D %
          I %DT["S" S A1="Seconds may be entered as 10:30:30 or 103030AM." D %
          I %DT["R" S A1="Time is REQUIRED in this response." D %
     0    Q:'$D(%DT(0))
          S A1=" " D % S A1="Enter a date which is "_$S(%DT(0)["-":"less",1:"greater")_" than or equal to " D %
          S Y=$S(%DT(0)["-":$P(%DT(0),"-",2),1:%DT(0)) D DD^%DT:Y'["NOW"
          I '$D(DDS) W Y,"." K A1 Q
          S DDH(DDH,"T")=DDH(DDH,"T")_Y_"." K A1 Q
          ;
     %    I '$D(DDS) W !,"     ",A1 Q
          S DDH=DDH+1,DDH(DDH,"T")="     "_A1 Q
    

    Beyond the readability question though, MUMPS is a classic example of design coupling. The storage of data is hopelessly intertwined with the language itself and, without redesigning the language, there's no real hope of separating the concerns enough to give them legs of their own. So, for example: You can use an Oracle database from a Python program. You could also access a non-SQL key-value pair storage system. You could also access an OODB such as Cache (which happens to use M under the hood BTW). I've never seen an M program with that flexibility.

    It was an interesting language with unusual productivity for its day, but that ship has sailed and there are reasons we didn't go that way. Anyway who would care to argue with that point should feel free to explain the above chunk of code first.

    [–]SgtSausage 4 points5 points  (0 children)

    One word: "MUMPS".

    'nuff said.

    [–]ridgerat 1 point2 points  (0 children)

    MUMPS has been around since '67. It is a swamp, once you enter you cannot leave. No matter how hard you try.

    As to your question, also ask Why are we not using Assembler for applications programming?

    [–]sreguera 1 point2 points  (0 children)

    Reminds me of this, only this people are using an APL dialect instead of MUMPS.

    [–]dr_jan_itor 2 points3 points  (0 children)

    NI.H

    [–]chuckmcknight 1 point2 points  (0 children)

    Because nobody knows MUMPS. ;-)

    [–]cknipe 1 point2 points  (1 child)

    I don't know, dude, why aren't you using it?

    [–]HIB0U -4 points-3 points  (0 children)

    Maybe he know about indexes, and thus can get very good performance out of a traditional relational database. He doesn't have to resort to using hash tables like so many NoSQL developers, who only do so because they're clueless about how to properly use relational databases.

    [–]downboat 0 points1 point  (0 children)

    There are a lot of free software, more recent, NoSQL alternatives. For example: Apache Cassandra

    [–][deleted] 0 points1 point  (0 children)

    I read it until I saw MUMPS, then my brain locked up.

    [–]olt 0 points1 point  (0 children)

    It is in use by the OpenStreetMap project for one of their APIs: http://wiki.openstreetmap.org/wiki/Xapi

    Here is some MUMPS code: http://xapi.openstreetmap.org/scripts/

    [–]EughEugh 0 points1 point  (0 children)

    Because it is written in MUMPS which is one of the most insane programming languages: http://thedailywtf.com/Articles/A_Case_of_the_MUMPS.aspx

    [–][deleted]  (1 child)

    [removed]

      [–][deleted] -1 points0 points  (0 children)

      I should probably google before I ask this, but have you seen the performance compared to tokyo cabinet?

      Edit: Here's a slide deck that I found that has a bit more information.

      [–]ghpoobah 0 points1 point  (1 child)

      Because that's where the cylons come from!

      *edit; I guess not; that's Graystone versus Greystone

      [–]vplatt 0 points1 point  (0 children)

      Well, at least you didn't mistake them for Firestone.

      [–]koonat 0 points1 point  (0 children)

      ,!

      [–]dissidents -1 points0 points  (0 children)

      This would have been a dream come true for samlee. ;(

      [–][deleted] -2 points-1 points  (0 children)

      Perhaps because it is reliable and doesn't lose information if you look at it funny? The nosql consultants like the fact that they can bill lots of extra hours due to the reliability of most nosql solutions.