DEV Community

Henrique Leite
Henrique Leite

Posted on

[WIP] JavaScript Vs Golang: Complexity

A lot of beginners start with JavaScript. The main reason for this is its simplicity: It's so simple that you can literally press F12 right now and start coding.

In this article I'll compare Golang and JavaScript in production environments, to see how their complexity scales over time.

The basics

Let's see what the most basic things that we need are in order to have a production API in each one of these languages.

Javascript

Runtime

  • NodeJs: Want to run JavaScript somewhere? You need it

Libraries

  • Express/Fastify/NestJs: Any JavaScript developer writes APIs without using a library?

Dev Libraries

  • TypeScript: Let's be real, is it really optional? Good luck trying to understand a production system without it
    • + a file to config it
  • ESLint: Or do you prefer to have your code full of errors that you discover only when running your code?
    • + a VSCode extension
    • + a file to config it
  • Prettier: Or do you prefer to allow that one dev to put { on newlines?
    • + a file to config it
  • Husky: Yes, you can use git-hooks, but does anyone that uses JavaScript use anything other than Husky? Will JavaScript developers know how to work with git-hooks directly?
    • + at least one file to config it

Extensions

  • VSCode Eslint Extension
    • + a file to config it to automatically format your code
  • VSCode Prettier Extension
  • A VSCode config file to recommend the necessary extensions

So just the basics of JavaScript require you to have 1 runtime, 1 library for production, 4 libraries for development, 2 extensions, and 7 configuration files.

JavaScript goes from 8 to 80 very, very fast.

Golang

Runtime

  • Golang

CLIs

  • Makefile

Extensions

  • VSCode Golang Extension
    • + a file to config it to automatically format your code
  • A VSCode config file to recommend the necessary extensions

The basics of Golang require 1 runtime, 1 CLI, 1 extension, and 2 configuration files. But why do we use Husky in JavaScript but don't have any library to make the same thing in Go? Because Golang developer will use git hooks directly.

Top comments (0)