Take advantage of the ecosystem

Is JavaScript the right language for businesses?

The trade-offs & benefits of betting on JavaScript

Seth Corker
Oct 8 · 6 min read

JavaScript is a language that’s fun to hate but its influence on modern software development is undeniable. Once a quirky language for the web, now a language that transcends the humble web browser. JavaScript runs on servers that power the web. It runs on mobile machines and IoT. It’s the lingua franca that traverses the many facets of computing. Despite this, JavaScript is not always the best tool for the job. It has great benefits but some substantial trade-offs. You need to weigh the pros and cons to determine if JavaScript is right for building your product.

Benefits

Three key benefits come to mind when choosing JavaScript. A rich ecosystem, impressive cross-platform support, and ease of development.

Photo by David Clode on Unsplash

Rich ecosystem

JavaScript has a vibrant and evolving ecosystem that is constantly growing. The popularity of JavaScript and npm has lead to an explosion of packages to help you focus on business objectives and deliver products quickly. There are many options available for whatever goal you need to achieve and great documentation that underpins these libraries. There are even sub-ecosystems built around libraries like React or web frameworks such as Angular and Vue. Having a good selection of high quality tools, libraries and support adds to the developer experience and makes developers more productive.

Photo by Kelsey Knight on Unsplash

JavaScript runs everywhere

There was a time when JavaScript ran in the browser and it wasn’t taken seriously. This is no longer the case. A JavaScript developer can become competent in the language and use their skills to target a multitude of platforms.

A developer can deliver:

  • Websites and progressive web apps to the web.
  • Create close to native apps on iOS, Android, Windows, MacOS and Linux.
  • Software for IoT devices
  • Power the infrastructure behind the product on servers.

The ability to use your development skills across a wide variety of platforms means your entire stack from front-end to back-end, mobile to desktop can share code — saving time and ensuring consistency.

If you use React for the front-end why not leverage that React knowledge and create your mobile app with React Native. Need a desktop app? Build it with React and Electron! The same development team can be productive on multiple platforms and deliver consistent experiences to many different devices.

Photo by Marc-Olivier Jodoin on Unsplash

Speed of development

Rapid development is the combined benefit of a vibrant ecosystem which runs almost anywhere. It’s quick to develop your product with JavaScript because there are libraries and frameworks available. It’s quick to scale up a development team because the popularity of JS brings with it a large pool of talented developers. Your team is more flexible because each developer can work in multiple codebases for products running on different devices, being proficient in the language they know.

Trade-offs

The biggest trade-offs when using JavaScript in production, mirrors the same benefits it offers. Like a many things in programming, blessings can actually be curses in disguise. Every benefit has an equal and opposite trade-off. These should be considered before making a decision.

Photo by Richard Lee on Unsplash

Abundance of choice and conflicting opinions

With so much choice in the JavaScript ecosystem, it can be pretty overwhelming. With such a wide gamut of backgrounds and goals, developers create competing libraries all the time. It’s common to see articles comparing different tools, technologies and paradigms. There is no a single source of truth, rather many sources all competing against each other.

You might decide to use JavaScript but then the floodgates open to questions like:

  • Should I use React or Vue?
  • Is webpack better than rollup.js?
  • How will components be styled? CSS, SCSS, CSS-in-JS?
  • Which web framework for Node.js is the fastest/easiest/powerful?
  • What rules should we use for linting?

There is no one-size-fits-all solution, there are differing opinions and difficult decisions that need to be reconciled and agreed upon by the team. Although it can be challenging to find the right balance for your project, there is freedom in finding the best tools for your specific use cases.

Photo by Amy Elting on Unsplash

A complex build system

The freedom that the JavaScript ecosystem provides results in a build system that can be complex and slow. Putting mobile and desktop aside, the build system for a modern frontend project may consist of many different steps that transform the JavaScript which is written into JavaScript that runs on the browsers you’re actually targeting. The decisions you and your team made earlier may come back to bite you.

If you go off the beaten path then expect some friction. You might spend more time digging through your webpack config file trying to figure out why your CSS isn’t coming out quite right. Investigating why your transpiled JavaScript doesn’t work in Internet Explorer. There are paths of least resistance which will aide you in your journey so it’s best to stick with the tried and trusted until you find your feet.

Photo by Steve Johnson on Unsplash

Speed of redevelopment

JavaScript is a language which allows developers to hack something together quickly. This is great for prototyping or small scale projects but the linger lived the project, the more room there is for error. The most freeing thing in JavaScript is the ability to get something working even if execution might result in a runtime exception. Although freeing at first, runtime exceptions become the most frustrating errors to debug. They lurk in the code base until you happen across them in your development environment. If you’re unlucky then a user might even experience a runtime error which has a negative impact on how users perceive your product. JavaScript alone is challenging to get right in larger teams which is why it’s often supplemented with tooling.

Want to avoid runtime exceptions and make refactoring easier?
Use TypeScript or Flow.

Want to ensure standards across the team?
Try eslint.

Need to stop arguing over code style and formatting?
There’s prettier.

Before you know it, it’s questionable whether you’re really using JavaScript any more or a hybrid behemoth. The speed of developing in the early days can slow down a bit until you find the right tools to create the development experience you and your team can work with.

How to Evaluate

An easy way to answer tell if JavaScript is right for your business is to say it depends but that’s not very helpful advice. Instead, ask yourself the following key questions.

  • What are your business objectives? Does JS meet these objectives?
  • Are you targeting mobile? Do you need a native experience?
  • What are your developers familiar with?

JavaScript is a tool. Some can wield it more effectively than others but in the end there are many to choose from and each one has benefits, constraints, limitations and quirks. If you have a team of well-versed JavaScript engineers then it’s the tool that is closest to them already. JavaScript might be the right choice for your business but you to have buy-in from your team and a reason to choose JS over the other options out there. Don’t choose it because everyone else is using it, choose it because it fulfils your needs and the needs of your stakeholders.

Benevolent Bytes

Thoughts, stories and ideas about development. Web development and beyond.

Seth Corker

Written by

Sharing ideas, facts, and opinions about programming. 📚 Learn more React and JavaScript. 🗺 Learn web development tips and tricks 🛸 Discover something new

Benevolent Bytes

Thoughts, stories and ideas about development. Web development and beyond.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade