JavaScript – The language without context.

 Javascript och jQuery, Nyheter, Webbutveckling  Kommentarer inaktiverade för JavaScript – The language without context.
Apr 012017
 

The peanut
You received a peanut.
You do not have the context. There is no way you know why you received a peanut and what to do with it.

If you feel hungry and I have peanuts, you ask me for a peanut, you get a peanut and you eat it.
That is context.

Lets say you want to do other stuff while you wait for a peanut. You want to surf on your phone.
You feel hungry, you say ”I am hungry, can anyone give me a peanut”, and then you start surfing on your phone.
I hear your message and I have peanuts, I give you a peanut. When you receive a peanut, then you eat it.

Now you do not need to know the extended context. It has been reduced to: ”When you receive a peanut, then you eat it.”.
I saw that you reacted this way and found it amusing, so I gave you another peanut, and another…

The Chinese businessmen
A group of Chinese businessmen have traveled to Sweden to look at a secret new prototype that the Chinese company are developing in Sweden. All information is in need to know basis.

The Chinese businessmen have traveled far, they are tired and hungry. Their secret task is to measure the prototype and call a secret buyer and relay the information. If the buyer say OK then the prototype will be shipped to the buyer. The Chinese businessmen are met at the factory by a very polite person.
– I am your personal contact person. I will always be at your side while you are here at the factory. The prototype is in the storage. If you give me instructions what to do with the prototype then I promise to execute them.

The Chinese businessmen really needed the prototype so they said:
– Your instructions are to bring the prototype back here. We will wait.
– Yes, I understand.

The contact person smiled and stood absolutely still.

What can we learn from the peanut and the prototype?
In JavaScript there is no way you can hide your context.
If you try then you end up with a peanut in your hand and a smiling Swede at your site.

Continue reading »