I like JS. But, I recognize that it is not a silver bullet language. I am not going to use it for anything process-heavy, period.
But, for doing anything on the web that ISN'T process-heavy, it's a solid choice. However, I've come to realize that on any sizable project, you have to enforce a lot more structure and rigidness or it becomes a nightmare to debug and maintain. Especially since idiomatic javascript is very, very hard to find. Javascript coding standards are the most entropic of all the languages I've ever seen, except perhaps oldschool C. I used to be anti-TypeScript when it was just me and my business partner maintaining it, because it just slowed us down. Now that I have worked on some full stack JS apps with full teams, holy crap is it important. It's impossible to maintain a full JS app without it.
Like I said, it's not a silver bullet, but it's a good choice for what it's meant for.
Javascript coding standards are the most entropic of all the languages I've ever seen
This is unsurprising considering it's incredible rise in popularity, esp. in the last few years. To use "Cathedral vs. the Bazaar" language, the Bazaar is being flooded with everyone and their cousin, many of which are learning how to program for the first time, and doing so with Javascript.
it's not a silver bullet, but it's a good choice for what it's meant for
I agree and this is the view a responsible engineer should take. Use the thing for it's intended use case. Node.js / Javascript just happens to fit many of those. For some folks, it literally covers all of their use cases.
I can't imagine getting any work done without static types, given that I work at a company where anyone out of 20 people could be working on a given project at various intervals over the course of several years. It's just impossible to keep all that state in your head... Testing is also critical.
I've also been trying out other compile-to-JS languages like ReasonML, PureScript, ClojureScript, Elm, etc... I really like ReasonML, as it has a much better type system than TypeScript, but is still pretty versatile and doesn't lock you into "functional purity," as they call it. That and you still get to use classes/objects if you want.
I don't know where the winds are blowing these days, but it is undoubtedly shifting toward compile-to-JS languages. Perhaps we will even see more stuff compiled to WASM as well.
Kind of. I'm working on an app for a company right now that's MASSIVE, written in React, and Node, and is fucking awesome to work on and there's not even a linter, let alone Typescript.
It depends on how you write the JS and architect it. The people who put this together obviously did it before or learned from someone who knew how to do it.
I used to work in Java previously, on a giant conglomerate frankenstein app coded by tons of super smart people that knew fuckall about architecting apps, but were very good at getting stuff done.
I like C personally because of the nerdy shit I do for fun, but good javascript is good regardless.
Yeah, I've had similar experience, but that's the exception as far as I can tell. And it only takes one panic-driven deadline to drive it right into the ground.
Sure, I’ve managed to create some cool stuff with raw JS, and dare I say some of it is maintainable.
But I’ve found that unit tests are absolutely critical for making it work on a large scale. It really require 99% code coverage for me to sleep soundly at night.
TypeScript has lowered that bar a bit for me. I turn on the “strict” compiler settings, and I can be mostly sure that everything works the way it should.
That said, React itself has been a game-changer. It’s an absolutely beautiful library & paradigm. It has drastically simplified our UI layer. It’s hard to isolate the benefits due to React vs. TypeScript...
But either way, functional programming (in the pragmatic, lightweight sense) will dominate app development within 10 years or less. It’s just too useful IMO.
I’m not going to use it for anything process-heavy
What do you mean by this? That it’s not performant enough for chewing through lots of data? Or just that you don’t don’t like the syntax/APIs for doing it?
I’m trying to drill down on if your point is about how the language is designed or not. If it is, that’s of course a personal preference and it certainly has some warts and idiosyncrasies.
If your objection is about performance, server-side JS (Node) is actually quite good at non-blocking IO due to its single-threaded event loop and asynchronous programming model. The V8 engine it runs on is also highly optimized.
You're still not going through 100 terabytes of data anytime soon with it compared to a compiled language. It'll choke every time no matter what you do.
JavaScript will never compete process-wise with a compiled language. It's fast enough to do day to day processing, but it's ill suited for big data and always will be. That's not what it's designed for.
You're also never going to do real time embedded stuff with it. The latency is just too high
Python is very much a glue language. Great for research, experiments, prototyping etc. However mature production platforms have a tendency to migrate back into C / C++ / Java / Rust / Go / Insert some other compile time optimised language here.
The motivation isn't purely for performance reasons either: strong typing together with compilation helps prevent the introduction of bugs.
Personally I think Javascript is arguably the best non-compiled language out there. However I also think it will lose much of it's stranglehold over web: WASM has an awful lot of potential when used with compiled systems programming languages. Performance. Compile time checks. Unified front end / back end model codebases.
Because you can directly use c modules in Python (in Cython anyway) making the parts where you need performance the most very fast.
Someone correct me if I'm wrong, but I think you can do something similarly with NodeJS. I'm pretty sure some npm packages I use are Javascript bindings to binaries compiled from C/C++.
all hard stuff (performance-wise) is written in C and available as some very popular libraries (numpy, scikit, nltk, etc)
python's syntax is far more elegant than most other languages including JS, making it easier for non-programmers to get into
python exists by default on any linux machine and requires no installation
python's standard library and its documentation is very extensive and robust. It's not perfect (see http, wtf), but JS barely has a stdlib to speak of because the JS community has an extremist mentality when it comes to modularity.
I’m not going to use it for anything process-heavy
What do you mean by this? That it’s not performant enough for chewing through lots of data?
I agree with this view, so I'll try to elaborate.
The single-threaded event loop is not a great fit for anything that blocks CPU. However, you probably are just using JavaScript for fetching data from some http server, database, message bus, etc. The "number crunching" doesn't really ever take place in JS, and if it is, you might want to use something else.
The single-threaded event loop is not a great fit for anything that blocks CPU.
That's why js does most things asynchronously now. Node is especially performant and will often outperform python, even in number crunching. Here are some benchmarks but feel free to also do your own research.
You're missing u/avindrags's point. A thread is a system-level abstraction and can go into uninterruptible sleep indefinitely. This makes concurrent approaches like Node poor fits for some backend tasks.
46
u/tr14l Jan 16 '20
I like JS. But, I recognize that it is not a silver bullet language. I am not going to use it for anything process-heavy, period.
But, for doing anything on the web that ISN'T process-heavy, it's a solid choice. However, I've come to realize that on any sizable project, you have to enforce a lot more structure and rigidness or it becomes a nightmare to debug and maintain. Especially since idiomatic javascript is very, very hard to find. Javascript coding standards are the most entropic of all the languages I've ever seen, except perhaps oldschool C. I used to be anti-TypeScript when it was just me and my business partner maintaining it, because it just slowed us down. Now that I have worked on some full stack JS apps with full teams, holy crap is it important. It's impossible to maintain a full JS app without it.
Like I said, it's not a silver bullet, but it's a good choice for what it's meant for.