Language layers

Hey Habr!

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

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

Language layers

And here is the source code on FOCAL:

Language layers

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

In general, I do a binary search to determine the value of K that, when used consistently, will land the ship perfectly. So I changed the program to only take one value and then applied it multiple times until the ship landed or crashed. As I write this, I know the answer lies between 76.40625 and 76.4453125, and I'll try 76.4257813. I'm starting to think I'll run out of time before I find the answer.

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

So, okay, let's think about this.

  • iPad has a chip A8X, with three cores running at a gigahertz or so.
  • Lua is written in C and compiles to A8X.
  • My PDP8 emulator is written in Lua using the package CODEA from the Two Lives Left section.
  • FOCAL was written in the late 1960s on a PDP8.
  • Lunar Lander was written in FOCAL.

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

What it is? Why so many languages? In fact, forget about the iPad, PDP-8, C, Lua and everything else. Why 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 little list:

  • FORTRAN
  • SOMETHING
  • COBOL
  • SNOBOL
  • LISP
  • BCPL
  • B
  • C
  • SIMULA
  • SMALLTALK
  • EIFFEL
  • C++
  • JAVA
  • C#
  • PYTHON
  • RUBY
  • LOGO
  • LUA
  • BASIC
  • PL/1
  • JAVASCRIPT
  • GO
  • DART
  • PROLOGUE
  • FORTH
  • SWIFT
  • ML
  • OCCAM
  • OCAML
  • ADA
  • ERLANG
  • ELIXIR
  • FOCAL

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

We don't like them.

Well, maybe that's 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
It's such a fine line.
This makes us look for the golden code.

And we are getting old.

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

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

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

That's what I think.

Deal with it. Stop searching. There is no perfect language. We searched everywhere. We looked up and down. We looked inside and outside.

We looked at languages ​​from both sides.
Inside and Outside
and still is anyway.
Remember that these are linguistic illusions.

We don't really understand anything in languages...
… at all.

Yes, today is an unusual day.

However, the point is:

We don't need another language.
We don't need to know the way home.
All we want is to go beyond life.
SQL

Yes, strange day.

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

And, in case you're wondering, 76.43844461 gives you a pretty good fit at 2.23 MPH.

Source: habr.com

Add a comment