Skip to main content
Engineering LibreTexts

5.1: Why Use ECMA 5 as a Basis?

  • Page ID
    27559
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \) \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\) \(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)\(\newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    There are a number of reasons to choose ECMA5 over ECMA6+ as a basis for this book. The first is that any future implementation of JavaScript30 will have to have the ability to be transpiled into ECMA 5. All of the nifty features built into ECMA6+ are built on a feature in ECMA5. My personal belief is that to understand a concept, the basis on which the concept is built should be known. If you want to program in C, you should know Assembly. If you want to program in Assembly, you should understand Computer Architecture and Computer Organization. While understanding the foundations on which ideas are built might not be necessary, there is almost always cases where not understanding them leads to difficult problems that would easily be fixed if a programmer understood the next lower layer of abstraction.

    The second reason for not choosing ECMA6+ is that the language is about making JavaScript more concise, e.g. add new features to the language that make it easier to write, probably harder to understand, and which definitely hide details that experienced programs do not need, but which hinder the understanding of novice programmers trying to piece together how things are connected. Once a programmer has an understanding of the parts, conciseness and ease are nice- to-haves. But trying to learn how to implement a function when there are a dozen different syntactic ways to define it (using the function statement, arrow functions with parameters, arrow functions with one parameter, block-scoped functions, and I am sure I missed some) is not my idea of fun.

    The third reason for not using ECMA6+ is that it seems to be built with the idea that programs will be written with a framework (React, Angular, Vue, Ember, yada, yada, yada). This is not a book about any of those frameworks or frameworks in general. The intent is to teach CS students CS principals and philosophies. Students can learn a framework, anyone one of which will be relegated to legacy status is 5 years, after they graduate.

    However, the biggest reason for choosing ECMA5 is that this is a book about understanding CS principals, paradigms, and philosophies, and how to put them together to build a program. This means limiting the complexity of the surrounding environment and concentrating on the underlaying infrastructure that illustrates interesting CS principals. The concept of unstructured data, as is laid out in JavaScript object representation. Object serialization and its realization in JSON data. Storing and retrieving this serialized data. Variable scoping, and specifics like function scoping that result in closures. Property maps and prototypes. These are issues that are of interest in a CS education. Syntactic sugar to make it easier to write programs, or to make a system more accessible to novice CS programmers, is the job of industry. I feel has no place in a CS education.


    30 At least until Web Assembly (WASM) becomes the accepted standard, which is still years away. But even WASM will have its roots in JavaScript 5.


    This page titled 5.1: Why Use ECMA 5 as a Basis? is shared under a CC BY license and was authored, remixed, and/or curated by Charles W. Kann III.

    • Was this article helpful?