FreeBSD Dynamic Programming

What is an outdated language anyway? Either it's the right tool for the job or it isn't. The only thing that changes is that more choices become available as time moves forward.
How about MUMPS (short for Massachusetts General Hospital Utility Multi-Programming System)? Yes, that's a ancient real life programming language, and oh boy it sucks. But since it is still widely used in the American Health Care System there's still a steady need of developers for it.

It was maybe the right tool for its job back in the old days 1966 because there wasn't much else, but nowadays... OUCH. Im pretty sure nobody sane would consider starting new projects in MUMPS these days, but there's so much legacy code around which still powers so much so...

Some shortened source code goodnees (taken from Wikipedia).

Code:
%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
     ;

And some of the features of that language:

CASE SENSITIVITY: Commands and intrinsic functions are case-insensitive. Variable names and labels are case-sensitive.
COMMANDS: may be abbreviated to one letter, case-insensitive. Includes commands such as IF, ELSE, GOTO, WRITE, and XECUTE [which is my personal favorite, it allows arbitrary execution of code contained in a variable]
OPERATORS: No precedence, executed left to right, parenthesize as desired. 2+3*10 yields 50.
DATA TYPES: one universal datatype, interpreted/converted to string, integer, or floating-point number as context requires.
DECLARATIONS: NONE. Everything dynamically created on first reference.
LINES: important syntactic entities. Multiple statements per line are idiomatic. Scope of IF and FOR is "remainder of current line."
LOCAL ARRAYS: created dynamically, any number of subscripts, subscripts can be strings or integers. Stored in process space and expire when process terminates.
GLOBAL ARRAYS: arrays that start with a caret symbol. Stored on disk, available to all processes, persist when process terminates. This is M's main "database" mechanism.

 
They look at your code, they see a goto somewhere and they react like there's a pile of dead human bodies in your drawer.
Enquiring minds want to know: how big is your drawer?!

The Go language has the "defer" statement precisely for the situation where you use goto. Still, the real point is not "goto considered harmful" but "spaghetti code considered harmful" and you can write spaghetti code without even a single goto! This is why things like "Cyclomatic Complexity" and "Halstead Volume" and "Maintainability Index" came about.
 
Well, as jbodenmann rightfully stated, many freshman students on universities are being told goto is bad by their lecturers. Not much more information given than that.

So at least their lecturers should tell them in my opinion where this comes from - Dijkstra's classic article - and that this is not written in stone. Some might have different views about it, and with good reason! Because nothing is more worse than learning something early as big nono without knowing why.
 
what we have to observe is that we don't have to hide behind the philosophy of professors, this limits us a lot in programming. our unix philosophy the program should be simple it's well done that's what i stand for. but some issues you raised he considered an excellent scientist by his work. dynamic programming algorithms that complement each other, sometimes mathematics surprises us by an unknown but not obscure universe. every engineer knows what it's like to spend years and hours trying to make his work not the best known. but each time better for humanity and each time possible to be something accessible, for all

I always argue don't do a program, do something special for people. let her see how our FreeBSD is something made for people with all their qualities
 
One place where I still find myself using goto is in initialization sequences that have non-trivial clean-up sequences attached to them (eg. multiple stages/phases of initialization where you have to perform the cleanup in a particular sequence if you have to abort mid-way).
I completely agree. I only would like to make the use case more general:

Goto’s are useful/needed for jumping out of the regular program flow.

Your example fully fits the bill.

Even Pascal, which was once THE language of choice for teaching programming have goto’s like C. Why? It keeps code for the regular logic clean, while at the same time you’re able to treat irregular cases, like insufficient resources, unexpected input, out-of-limit results, etc. in a sane way.
 
I just dedicate myself some language like C Language, Rust Perl Language

I don't see so much need, to learn, so much language, but nowadays they teach about language and give little importance to the algorithm and you have young people insecure when it comes to producing something.

you know i have my limits i want a woman to go out with me sometimes, and talk about how your day was. and so we'll start a conversation about work. what I see in these young amateurs and think they think they know everything they know everything. just because you learned or read a book in several languages.

to learn a language really requires 5 years of dedication, and being a person who likes to contribute to some project
 
Back
Top