JavaScript & It's Industry Use-Cases
Yash Ingle
Aspiring Software Engineer | ARTH Learner | Technical Volunteer at MLOPS Summer Internship 2021 | Google DSC Technical Lead
In this article we will see what is JavaScript and its Industry Use-Cases .
Imagine you’re a new graduate. What is the only language that will allow you to build web applications, APIs, mobile applications, and desktop apps? JavaScript. Increasingly, that’s precisely what new grads are reaching for. Why should a new grad learn a dedicated server-side technology when JavaScript runs everywhere?
JavaScript has already found its way into native applications, and as the world around us is getting connected, JavaScript will be absolutely everywhere.
What is JavaScript?
JavaScript is a client-side programming language which helps web developer to do Web Application Development and make dynamic and interactive web pages by implementing custom client-side scripts.
Developers can also use cross-platform runtime engines like Node.js to write server-side code in JavaScript. Developers can also create web pages which works well across various browsers, platforms, and devices by combining JavaScript, HTML5, and CSS3.
There are many JavaScript Frameworks available in the web market like AngularJS, ReactJS, NodeJS etc. By using these frameworks, you can reduce the amount of time and efforts required for developing JS based sites and apps. JavaScript allows the programmers to build large-scale web application easily. It simplifies the whole process of developing large-scale web applications.
Common examples of JavaScript that you might use every day include the search box on Amazon, a news recap video embedded on The New York Times, or refreshing your Twitter feed.
Advantages of JavaScript
JavaScript completely changed the way the world looked at browsers. It gave the ability to build complex websites and make the whole business process digital! Some advantages of JavaScript are:
- High performance: JS is lightweight & fast as it can be immediately run on the browser (client machine)
- Simple and popular: We have been using it for ages, and it hasn’t lost the hold!
- Interoperable: can be used with a variety of other languages and applications
- Reduces server load as it works on the client-side
- Makes pages lively, dynamic, and rich
- It comes with many free tools to enhance functionality
- The functionality of JS can be extended to the backend using Node.js
What can in-browser JavaScript do ?
Modern JavaScript is a “safe” programming language. It does not provide low-level access to memory or CPU, because it was initially created for browsers which do not require it.
JavaScript’s capabilities greatly depend on the environment it’s running in. For instance, Node.js supports functions that allow JavaScript to read/write arbitrary files, perform network requests, etc.
In-browser JavaScript can do everything related to webpage manipulation, interaction with the user, and the webserver.
For instance, in-browser JavaScript is able to:
- Add new HTML to the page, change the existing content, modify styles.
- React to user actions, run on mouse clicks, pointer movements, key presses.
- Send requests over the network to remote servers, download and upload files (so-called AJAX and COMET technologies).
- Get and set cookies, ask questions to the visitor, show messages.
- Remember the data on the client-side (“local storage”).
What CAN'T in-browser JavaScript do?
JavaScript’s abilities in the browser are limited for the sake of the user’s safety. The aim is to prevent an evil webpage from accessing private information or harming the user’s data.
Examples of such restrictions include:
- JavaScript on a webpage may not read/write arbitrary files on the hard disk, copy them or execute programs. It has no direct access to OS functions.
- Modern browsers allow it to work with files, but the access is limited and only provided if the user does certain actions, like “dropping” a file into a browser window or selecting it via an <input> tag.
- There are ways to interact with camera/microphone and other devices, but they require a user’s explicit permission. So a JavaScript-enabled page may not sneakily enable a web-camera, observe the surroundings and send the information to the NSA.
- Different tabs/windows generally do not know about each other. Sometimes they do, for example when one window uses JavaScript to open the other one. But even in this case, JavaScript from one page may not access the other if they come from different sites (from a different domain, protocol or port).
- This is called the “Same Origin Policy”. To work around that, both pages must agree for data exchange and contain a special JavaScript code that handles it. We’ll cover that in the tutorial.
- This limitation is, again, for the user’s safety. A page from https://anysite.com which a user has opened must not be able to access another browser tab with the URL https://gmail.com and steal information from there.
- JavaScript can easily communicate over the net to the server where the current page came from. But its ability to receive data from other sites/domains is crippled. Though possible, it requires explicit agreement (expressed in HTTP headers) from the remote side. Once again, that’s a safety limitation.
JavaScript Use-Cases and there Benefits
1. PayPal
PayPal is one of the world’s largest and the most trusted services for paying, sending money and accepting payments. The platform allows its users to interact with each other virtually, without involving debit or credit card disclosure. For November 2017, PayPal has over 200 million active accounts.
Interestingly, Node.js was not the go-to technology for Paypal from the very start. According to @paypaleng, their initial concern was the segmented teams: those who code separately for a browser (using HTML, CSS and JavaScript), and those who code for server applications (using Java). Thus, the boundary between the browser and the server was the primary blocker.
The solution was to use JavaScript for writing both browser and server applications, and, therefore, uniting their engineering specialties into one team.
Benefits of Node.js for PayPal:
- Node.js app for PayPal was built 2 times faster with fewer people working on it, as compared to the previous Java based app
- Doubled request per second
- 35% decrease in the average response time for the same page
- 33% fewer lines of code
- 40% fewer files
2. Uber
Uber is a global transportation company, headquartered in San Francisco, CA. The company is doubling in size every 6 months, operates in 6 continents, 68 countries, 633 cities worldwide. Since its launch in 2012, Uber has become one of the most recognized alternatives to a traditional taxi. Therefore, Uber needs a platform that will keep running no matter what.
Their app connects driver-partners and riders, thus, it has to process enormous amount of information at a fast-growing scale. Uber chose Node.js to build its massive matching system due to its ability to keep up with the pace of Uber’s huge business needs and enhanced data processing capabilities.
Benefits of Node.js for Uber:
- Quick and reliable processing of extreme amount of data
- Elimination of errors without the need to restart
- Quick deployment of the new code
- Strong open source community that constantly develops new solutions
3. LinkedIn
Despite the fact that many consider LinkedIn as old-fashioned and outdated, it is still the most popular business-oriented social network and a convenient tool for successful employment. LinkedIn has 467 million users from over 200 countries. In 2016 Microsoft bought LinkedIn for $26 billion.
LinkedIn decided to replace their synchronous Ruby on Rails mobile app, in which clients used to make several calls for a single page, with an asynchronous evented system. Therefore, they made up their mind on Node.js due to its scalability and performance efficiency. And, Node.js satisfied their expectations.
Benefits of Node.js for LinkedIn:
- 10x reduction in the number of machines for service hosting
- Servers cut from 30 to 3Doubled traffic capacity
- Much better performance and lowered memory overhead
- New mobile app is up to 20x faster in some scenarios
- Front-end and back-end mobile teams combined into a single unit
- Enough headroom remains to handle 10x current levels of resource utilization
4. Ebay
eBay is one of the world’s largest marketplaces, offering consumer-to-consumer and business-to consumer internet sales services. It has 183 million active users, and operates in 37 countries.
The main problems the giant faced were scalability and huge traffic. eBay engineers considered different solutions to tackle these technical challenges, and, after tough internal debates, finally chose Node.js.
Benefits of Node.js for eBay:
- Speed and simplicity
- Seamless and easy deployment
- Single threading
- Meeting the main requirement: “Automate the process, build once, and deploy everywhere”
5. Netflix
Netflix is the world’s biggest provider of streaming media and video-on-demand, including movies and television series. The service is available in more than 190 countries. In 2013, Netflix expanded into film and television production and online distribution, as well as production of their own original programming. In the third quarter of 2017, Netflix had over 109 million streaming subscribers worldwide.
Netflix had a stable and full-featured application, and they wanted to make it modular and lightweight, reduce complexities, and power user interfaces specifically, while at the same time leverage their existing infrastructure. That is why they decided to shift the whole user interface to Node.js. Node.js runtime has proved to be so efficient, so the Netflix team is even moving data access layers to it.
Benefits of Node.js for Netflix:
- Startup time of the new application reduced by 70%Streamlined development
- Cut build times
- Increased level of customization for each user
There are many Companies which are benefited from JavaScript.
Thank You For Reading??