📜 ⬆️ ⬇️

The most underrated language in the world

Javascript logo
JavaScript, also known as Mocha, or LiveScript, or JScript or ECMAScript is one of the most popular programming languages. In fact, every personal computer has its interpreter and actively uses it. JavaScript is entirely due to its popularity that it has become the main scripting language for the web.

Despite its popularity, few people know that JavaScript is a very good object-oriented language with many features. Why many do not understand this? Why is this language so misunderstood?


')

Title


The “Java-” prefix hints that it is a subset or a simplified version of Java. Apparently this name was chosen specifically to create confusion, and misunderstanding emerges from it. JavaScript is not interpretable java. Java is interpreted Java. JavaScript is another language.

JavaScript syntax is as similar to Java syntax as Java is C. And it is no more a subset of Java than Java is a subset of C. It is better than Java in applications for which Java (then called Oak) was originally developed.

JavaScript was not created by Sun Microsystems, the creators of Java. JavaScript was developed in Netscape. It was originally called LiveScript, but this name was not so confusing.

The suffix "-Script" implies that this is not real programming, that a scripting language is significantly worse than a programming language. But in reality it all depends on the specialization. Compared to C, JavaScript sacrifices speed for expressive possibilities and dynamism.

Lisp in the shoes of C


JavaScript has a C-like syntax, including curly braces and cumbersome expressions that make it look like a regular procedural language. In fact, JavaScript has more in common with functional programming languages like Lisp or Scheme than with C or Java. It has arrays instead of lists and objects instead of a list of properties. Functions are its basis. It has closures. You can use lambda calculus without having to juggle with parentheses.

Typability


JavaScript was designed to work in Netscape Navigator. Its success has made it an integral part of all browsers. This resulted in free typing. JavaScript is George Reeves among programming languages. JavaScript is well suited for a huge number of non- web-based applications.

Moving target


The first versions of javascript were rather weak. They lacked exception handling, nested functions and inheritance. This is now a fully object oriented language. But many of his views are based on his first versions.

The ECMA committee, which develops extensions to the language, despite good intentions, created one of its biggest problems: too many versions of it have already been done. This creates confusion.

Design errors


No programming language is perfect. JavaScript has its own design errors, such as overloading the "+" operator, which means adding and concatenating types at the same time, and a frequent source of errors is the with statement, which is best avoided. Policies for reserved words are too strict. Using the semicolon was a huge mistake, as was the direct entry in the regular expression code. These errors led to programming errors, and put the entire design of the language in question. Fortunately, most of these problems can be avoided with a good programming style.

Problems in design are quite obvious. Surprisingly, the ECMAScript committee has no interest in correcting it. Perhaps they want to create a new language.

Bad implementation


The first implementations of JavaScript were quite buggy. It had a bad effect on the language. In addition, they were embedded in a very buggy browsers.

Bad books


Honestly, all books on javascript are terrible. They contain mistakes, bad examples and give bad instructions. Important language features are poorly explained, if at all. I read a dozen books on JavaScript and can only recommend one: JavaScript: The Definitive Guide (5th edition) written by David Flanagan.

Double standards


The official language specification is written by ECMA. And she's just terrible quality. It is hard to read and even harder to understand. The source of the problem with bad literature is that authors cannot use standard documentation in order to better understand the language. The ECMA and TC39 committees only get in the way.

Programmers


Most people who write in JavaScript are not programmers at all. Ona do not have the necessary knowledge and patience to write good programs. But in any case, JavaScript has such strong expressive power that they can do something useful. This has created a javascript reputation for newbies not suitable for professional programming. And this is not the case at all.

Object oriented language


Is javascript an object-oriented language? It has objects that store data and methods that can process this data. Objects may contain other objects. It does not have classes, but it does have constructors that do the same thing, including playing the role of a container for variables and class methods. It does not have class-oriented inheritance, but it has prototype-based inheritance.

The two main ways to build an object system are inheritance (to be someone) and aggregation (to have something). JavaScript can do all this, but its dynamic nature allows you to exceed aggregation.

One of the arguments for the fact that JavaScript is not an object-oriented language is that JavaScript cannot hide data. This is so, objects cannot have private variables or methods: all parts of the object are open.

But it turns out that objects in JavaScript can have private variables and methods . Of course, only a few understand this, because JavaScript is the most incomprehensible programming language in the world.

Another argument is that JavaScript does not support inheritance. In fact, JavaScript not only supports classical inheritance, but also other ways to reuse code .

Post Scriptum: yes, the article is quite large and old, but it is worth reading, especially in connection with the development of JavaScript 2 .
Update: Thanks to Outspector for the huge number of fixes .

Source: https://habr.com/ru/post/31481/


All Articles