Industry Use-Cases of JavaScript
We all know that javascript is used everywhere. Each and Every application use javascript in some parts of their code. Why it is so important? Why are every top company adopting javascript frameworks as their frontend?
So, Let’s start talking about javascript.
What is JavaScript? Is it somehow related to java?
JavaScript is a scripting or programming language that allows you to implement complex features on web pages — every time a web page does more than just sit there and display static information for you to look at — displaying timely content updates, interactive maps, animated 2D/3D graphics, scrolling video jukeboxes, etc. — you can bet that JavaScript is probably involved. It is the third layer of the layer cake of standard web technologies, the other two of which are(HTML and CSS)
So what can it really do?
The core client-side JavaScript language consists of some common programming features that allow you to do things like:
- Store useful values inside variables.
- Operations on pieces of text (known as “strings” in programming).
- Running code in response to certain events occurring on a web page.
- And much more!
What is even more exciting however is the functionality built on top of the client-side JavaScript language. So-called Application Programming Interfaces (APIs) provide you with extra superpowers to use in your JavaScript code.
APIs are ready-made sets of code building blocks that allow a developer to implement programs that would otherwise be hard or impossible to implement.
They generally fall into two categories.
Browser APIs are built into your web browser, and are able to expose data from the surrounding computer environment, or do useful complex things. For example:
- The
DOM (Document Object Model) API
allows you to manipulate HTML and CSS, creating, removing, and changing HTML, dynamically applying new styles to your page, etc. Every time you see a popup window appear on a page, or some new content displayed (as we saw above in our simple demo) for example, that's the DOM in action. - The
Geolocation API
retrieves geographical information. This is how Google Maps is able to find your location and plot it on a map.
Third-party APIs are not built into the browser by default, and you generally have to grab their code and information from somewhere on the Web. For example:
- The Twitter API allows you to do things like displaying your latest tweets on your website.
- The Google Maps API and OpenStreetMap API allow you to embed custom maps into your website, and other such functionality.
Is JavaScript has anything to do with Java?
Ofcourse not Java ≠ JavaScript
When you’re first getting started with programming, your ears start to perk up at new words. You start catching familiar terms in a sea of foreign phrases. When you come across words that you’ve heard before, you may start making associations: object and object-oriented, function and functional, variable and constant, etc.
This natural tendency may be why so many new developers think that Java and JavaScript are the same, similar, or related in any way at all, when in fact, their association is no closer than any other two languages chosen at random. The only story that these two distinct languages share is the one of a marketing gimmick.
They are Different in Significant Ways
Sure, Java and JavaScript are both programming languages and you can use both of them to build applications, but the same could be said about any two choices in the grand lexicon of programming languages.
Again, Java is a general-purpose programming language that is compiled, concurrent, strongly typed, class-based and object-oriented. JavaScript, on the other hand, is primarily a web language* that is interpreted, single-threaded, loosely typed, prototype-based and multi-paradigm.
How Netflix adopts Javascript?
The team behind Netflix.com has switched from a Java-based HTML renderer to a JavaScript one that they can run on both the server and the client.
To decrease the time users spent waiting, Netflix has removed the Java server-based renderer and reduced the amount of HTML sent down the wire.
How Netflix did product transformation using Node.js?
However, for a long time, JavaScript was a language exclusively oriented towards client-side development and never managed to establish itself for backend purposes — at least until 2009, when the first version of Node.js was launched. For the first time in history, JavaScript became a viable alternative for backend solutions.
Netflix is the best example that leveraged the benefit of Node.js by implementing it for production and they achieved tremendous result-economically and in performance.
Netflix is one of the world’s largest online media streaming providers delivering almost 7 billion hours of videos to nearly 50 million customers in 60 countries per quarter.
Earlier Netflix was using Java on the server-side and javascript on the frontend side so developers had to code twice, which required them to understand both languages. They had to write everything twice for error handling, activity tracking, and debugging.
The primary reasons of Netflix to move to Node.js
- Have a common language for both server-side and browser side.
- Performance that Node.js offers. From a 40 minute + startup time they went to under a minute
- Node has a lot of modules that are mostly open source.
- To build the single-page application.
Thank You All!