Language layers

Hello, Habr!



I bring to your attention a translation of the article “ Language Layers ” by Robert C. Martin (Uncle Bob).



image






I spend time playing the old 1969 Lunar Lander game. It was written by Jim Storer, a high school student. He wrote it on PDP-8 in FOCAL. Here's what the program looks like:



image



And here is the source code for FOCAL:



image



Jim Storer was a fairly talented high school student. Take a look at this code. He has quite interesting Taylor expressions there.



In general, I conduct a binary search to determine the value of K, which, when used in series, will ideally land the ship. Therefore, I changed the program so that it took only one value, and then applied it several times until the ship lands or crashes. As I write this, I know that the answer lies between 76.40625 and 76.4453125, and I will try 76.4257813. I'm starting to think that I will run out of time before I find the answer.



Meanwhile, it occurred to me that I ran this program on the PDP-8 emulator, which I wrote on Lua for the iPad.



So, well, let's think about it.





So these are A8X, C, Lua, PDP8 and FOCAL. These are five different languages. Five different mechanisms telling the machine what to do; they are all stacked on top of each other!



What it is? Why are there so many languages? In fact, forget about the iPad, PDP-8, C, Lua and everything else. Why are there so many languages?



## Why are there so many languages?



Think about it! How many programming languages ​​can you name? Here, let me give you a short list:





You, of course, can think of others that I have not mentioned. The question is, why are there so many? There can really be only one answer to this question. The reason there are so many computer languages:



We do not like them.



Well, maybe this is too strong a statement. Perhaps I should say:

We were in Hollywood.

We were in Redwood.

We crossed the ocean for the golden code.

We were out of our minds

This is such a fine line.

This makes us look for a golden code.



And we are getting old.

Okay, maybe I should speak for myself ... Didn’t you just want to yell at Neil Young so that he would stop complaining, find some nice girl and live with her? Didn't you want to tell him that the quest for a golden heart was useless? Tell me, what would he do with him if he found him?



And what would we do with the perfect language if we found it?

We created the PDP-8 and FOCAL emulators to play the “Lunar Lander” written by a high school student in 1969!

That's what I think.



Deal with it. Stop the search. There is no perfect language. We searched everywhere. We looked above and below. We looked inside and out.

We looked at languages ​​from both sides.

Inside and out

and still anyway.

We recall that these are linguistic illusions.



We really don’t understand anything in languages ​​...

... absolutely.

Yes, today is an unusual day.



But, nevertheless, the bottom line is:

We do not need another language.

We do not need to know the way home.

All we want is to go beyond life.

SQL

Yes, a strange day.



So there is one thought. Maybe we need to stop creating new languages ​​and just calm down and choose one or two that are really good. It will make life a lot easier, right?



And, if you're interested, 76.43844461 gives you a pretty good fit at 2.23 MPH.



All Articles