About JavaScript – Part I

This morning I received a message from a discussion forum for the Graph Analytics for Big Data from the University of California San Diego by Coursera. I completed the course last year.

I tend to post now and then when I really see a need. Since then at least three students have used the contents of the post and were kind enough to leave me a message. I do appreciate it. Hope it helps fellow students even if they were in a hurry and did not have time to leave a thank you note. Feels good, what can I say.

In this post I will cover some notes I took when going over a Beginners Guide to Understanding JavaScript by Daniel Stern. Very high level, but as I have mentioned on several occasions, it is good to read and then experiment to make sure you understood the message intended by the author. In this case, as far as I have seen so far, there is no actual code. The idea is to provide a global overview so you can then dive into what interests you the most. At this time I am not particularly interested in web development, I am more interested in the back end and micro services using different programming languages and middle ware.

My notes follow. Please note that I am attempting to put together sentences from just a few words I jotted down.

JavaScript (JS) is a programming language. It is supported by default in all major web browsers (e.g., Chrome).

JS is a dynamic programming language which means it is not compiled, it is interpreted. JS was initially designed mostly for small applications. Today it is used by back end servers (Node.js) and No-SQL database engines (e.g., MongoDB).

EcmaScript is JavaScript. Years ago, when Java applets failed, JavaScript became the “Language of the Web” by default. EcmaScript is now ES2 (around 2016). Node.js runs JavaScript – popular and effective back end.

Among the different type of applications that use JS one can count home automation, aircraft, web browsers, robots, among others. For web browsers, JavaScript is required for all but the most basic interactivity.

Express.js responds to HTTP requests (on top of Node.js). Node.js interacts with the operating system. Database communication is often in JavaScript (e.g., MongoDB).

TypeScript is a JavaScript pre compiled language. It is used and was developed by Microsoft. It runs on Windows platforms.

Adobe AIR is a cross-platform run time system to generate applications that run on different JavaScript platforms. With Unity + Stream developers using JS can generate games for consoles. JS can be used to develop console applications (the ones that run on the Command Prompt on Windows) and game consoles. That is impressive!

JS is commonly used to develop software for the Internet of Things (IoT). Drones and robots are using johnny-five.js as a programming framework. You can find the software repository on GitHub. It seems to support the Arduino boards and others via IO plugins. With the Raspberry Pi family of boards you can quickly implement home automation tasks.

JS is used in modern website authoring, effective JavaScript workflows, and debugging. Some of the most important libraries are Angular and JQuery. JavaScript is typically used on web servers, for package management, workflow automation, simulation and game authoring tools.

What is a Website? It is a destination on the web that can be reached via HTTP(S) protocols. A website sends documents in response to HTTP Requests. A document is typically composed of HTML, CSS, and JavaScript. Websites are interactive.

The question is, do we need JavaScript? HTML and CSS are adequate in most cases. JavaScript is used for advanced interactivity.

JavaScript (AJAX == Asynchronous JavaScript) is required to display new information without reloading the entire page which is slow and inefficient. JS complements CSS and HTML to deliver optimum user experience.

JavaScript can perform real-time updates (AJAX), it can be used for session management (cookies), analytics, and cross-device compatibility among others. Enthusiasts claim that JS can be used for everything.

With Chrome development tools you can work with application in Google Chrome and many other web browsers. Similar versions exist for Firefox and IE. Chrome development tools are a fast way to prototype and debug JavaScript code.

To develop code in JavaScript you can use a text editor. Developers prefer to use an IDE. There are dozens of possible text editor choices. IDEs are optimized for code completion, “linting”, and automation, but in several instances they are available for a price. Browsers are part of IDEs, which reloads automatically when there is a change. One can debug code with development tools, but an IDE seems the best way to go.

Among some popular IDEs for JavaScript one can choose from Sublime, IntelliJ WebStorm) or Brackets. I personally use WebStorm which is a reasonably paid option.

A JavaScript library is used to patch inconsistent browser behaviors (e.g., jQuery). With a library one can write everyday code quickly and easily. There are thousands and thousands of JS libraries and programs that one can use in everyday work.

A JavaScript framework provides an “opinionated” set of tools which prescribe building parts of or entire websites in a certain way.

Frameworks may resolve issues with user experience, scalability, or testing (Angular, React by Facebook). Frameworks are an essential part of modern web application experience.

JQuery pays to learn it. It provides an abstraction for DOM manipulation. It has a rich plugin ecosystem. JQuery is wildly popular – expect to find it in every project.

There is a JavaScript framework called AngularJS which was eventually superseded by Angular (a web framework) also known as Angular 2+.

It is a popular and opinionated framework for building Single Page Applications (SPA). There is a steep learning curve associated with Angular2 but it is worth learning it. Angular is actively maintained by Google. Angular is written in TypeScript. It is a web framework and uses the MIT License.

Modern websites are structured for speed; it is the top priority. They use a front-end framework implemented (e.g., React.js on Facebook). Node.js pre compiles web applications, creates “isomorphic” code. In general, web page slow refresh on any type of device (especially mobile) should be avoided at all costs.

Hope you enjoyed this quick partial introduction to JavaScript. I will follow up with one or two additional posts.

Keep on reading and experimenting. It is the best way to learn.

If you have comments or questions regarding this or any other post in this blog, or if you need some help with any phase of the SDLC, please feel free to leave me a message bellow. Requests for help will not be made public.

John

Follow me on Twitter:  @john_canessa

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.