Featured in AI, ML & Data Engineering

In this article, author shows how to use big data query and processing language U-SQL on Azure Data Lake Analytics platform. U-SQL combines the concepts and constructs both of SQL and C#. It combines the simplicity and declarative nature of SQL with the programmatic power of C# including rich types and expressions.

Featured in Culture & Methods

The book Agile Leadership in Practice - Applying Management 3.0 by Dominik Maximini is an experience report of the agile transformation journey of NovaTec. Maximini shares his experiences from applying principles and practices from Management 3.0, success stories, failure stories, and learnings from experiments.

Featured in DevOps

Yuri Shkuro presents a methodology that uses data mining to learn the typical behavior of the system from massive amounts of distributed traces, compares it with pathological behavior during outages, and uses complexity reduction and intuitive visualizations to guide the user towards actionable insights about the root cause of the outages.

ECMAScript 5 released

ECMAScript 5 was released this week (pdf), generally known as JavaScript™, bringing advances to the basic libraries whilst introducing stricter runtime modes to aid with identifying and removing common coding errors.

Earlier attempts to rationalise ECMAScript 4 largely failed; only Adobe's ActionScript is based on the proposed changes. ECMA didn't even release a version 4 specification owing to different groups being unhappy at the developments; and as such, no browsers support it.

Over the last few years, with large improvements in JavaScript engines like Nitro and TraceMonkey, JavaScript has become performant to the extent that collaborative tools like Google Wave are showing the way forward for on-line applications. There's even Speed Tracer, an extension to Google Chrome, released as part of GWT 2.0, to help optimise the performance of JavaScript applications.

With that in mind, ECMAScript 5 aims to be backwardly compatible with the currently in-use ECMAScript 3 version (to foster quicker adoption across browsers), as well as providing for stricter constraints for developers to avoid common coding pitfalls.

Strict mode

The introduction of strict mode aims to avoid common coding problems in ECMAScript applications. This is achieved with the presence of a lone string literal in a unit (script or function):

"use strict;"

This literal will have no effect on existing runtimes, but new runtimes that target version 5 will turn on strict mode for either the entire script (if at the top of the script) or for a single function (if the first part of a function). This allows for a mixture of strict and non-strict code and for an evolution of existing code. So, what does strict mode actually mean?

Variables must be declared before use. In other words, i=3 becomes a runtime error; var i=3 is needed (assuming i is not in scope at the time)

Eval becomes a reserved word, and introducing new variables through eval cannot occur, so eval("var i=3"); print(i); will now throw an error.

Octal literals are no longer used; so 010 is ten, and not eight

delete cannot be used against arguments, functions or variables or other properties with the configurable flag set to false

with statements, often a source of errors, are no longer used and considered syntax errors

Functions can no longer have duplicate arguments with the same name

Objects can no longer have duplicate properties with the same name

The arguments and caller variables become immutable

Access to the global object becomes a runtime error

Library extensions

Other extensions are also present in the base library:

Date now supports the ability to generate ISO8601 formatted dates (such as 20091209T12:34:56Z) as well as to parse them

String now has a built-in trim() method

A new JSON object with parse and stringify to support efficient generation of JSON data; like eval but without the security implications of being able to reduce code. In addition, any JSONValue can be used, not just JSONObject and JSONArray as specified in RFC 4627. (4627 defines JSON-Text to be constrained to an object or array.)

Array now has standard functions, such as indexOf(), map(), filter(), and reduce()

Object now has seal() (which prevents new properties being added or existing properties deleted) and freeze() (which makes all properties read-only, as well as preventing new properties being added or deleted)

Object.keys() lists all the enumerable properties of the object

Object.getOwnPropertyNames() lists all the enumerable and non-enumerable properties

Object.getPrototypeof() returns the prototype of the given object

Summary

The additions of a standard JSON parsing mechanism and strict mode will be of great benefit to developers, with the potential to translate into smaller libraries for Prototype and other extension libraries required. Parsing ISO dates from a JSON stream now becomes much more portable than before, and looks likely to be the de facto standard for representing dates in the future. Lastly, since this is backwardly compatible and takes cues from existing libraries like Prototype, it is likely that developers and web browsers alike will take to the new features of JavaScript in the near future.