Comment by pmarreck
2 years ago
> It costs nothing to actually put down a reason for being upset, versus having totally generic downputs
Actually, it does cost something- time and effort- but thanks to the latest AI, I can cut some of that out right now:
As an Elixir enthusiast, I'd like to point out some technical criticisms of JavaScript and its ecosystem, particularly in comparison to Elixir's approach to dependency management and community.
A) Dependency bloat: The JavaScript ecosystem, especially when working with Node.js, often suffers from excessive dependencies. Even when you require just a few dependencies for your project, you may end up pulling in a large number of indirect dependencies. This can lead to increased complexity, slower build times, a larger attack surface for potential security vulnerabilities, and an ever-growing workload spent applying security fixes that have nothing to directly do with the purpose of the web app.
In contrast, Elixir's dependency management system, powered by Mix and Hex, encourages a more conservative approach. Elixir libraries are often designed with minimal dependencies, and the community values self-contained, focused libraries.
B) Security concerns: The extensive use of third-party packages in JavaScript projects can expose your application to security risks. When you pull in a large number of packages, you become responsible for ensuring that all of those dependencies are up-to-date and secure.
Elixir's ecosystem tends to have fewer dependencies, reducing the potential attack surface. Additionally, Elixir's focus on immutability and the actor model can help minimize the impact of security vulnerabilities.
C) Lack of native concurrency and parallelism: JavaScript is single-threaded by design, which can limit its ability to take full advantage of multi-core systems. While Node.js introduced asynchronous I/O to help mitigate this issue, it can still be challenging to build highly concurrent applications in JavaScript.
Elixir, built on the Erlang VM (BEAM), provides excellent support for concurrency and parallelism through lightweight processes, message-passing, and the actor model. This allows Elixir applications to scale across multiple cores and handle a large number of simultaneous connections more efficiently than most JavaScript applications.
D) Callback hell and async/await complexity: JavaScript has traditionally relied on callbacks for asynchronous programming, which can lead to a phenomenon known as "callback hell" when dealing with nested callbacks. While the introduction of async/await has improved this situation, it can still be cumbersome and confusing for developers.
Elixir offers a cleaner approach to concurrency with its process-based model and message-passing mechanism, enabling easier-to-read and maintainable code.
E) Mutable data- One of the key differences between Elixir and JavaScript is the way they handle data. Elixir enforces immutability, meaning that once a data structure is created, it cannot be modified. Instead, operations on data structures in Elixir return new versions of the data, leaving the original untouched. This approach offers several advantages compared to JavaScript's mutable data structures:
1) Predictability and easier reasoning: Immutability in Elixir makes it easier to reason about and understand your code. Since data structures cannot be changed once created, you don't have to worry about unintended side effects or data being altered in unexpected ways. This results in more predictable and maintainable code.
2) Concurrency safety: Elixir's immutable data structures simplify concurrent programming by eliminating the need for locks, mutexes, or other synchronization primitives. This is because multiple processes can safely read and share the same data without the risk of data corruption due to concurrent modifications. In JavaScript, managing shared mutable data in concurrent scenarios can be error-prone and challenging.
3) Functional programming: Immutability is a core principle of functional programming, and Elixir is heavily influenced by this paradigm. Functional programming promotes the use of pure functions that do not produce side effects, which can make code more modular, reusable, and easier to test. While JavaScript supports functional programming concepts, its mutable data structures can make it more challenging to adhere to functional programming principles.
4) Reduced cognitive load: Immutable data in Elixir means that developers don't have to keep as much track of changing state as they read or write code. This can make it easier to understand the flow of data and logic in your application, leading to a more pleasant and efficient development experience and ultimately, fewer bugs generated per LOC.
F) Community values: The JavaScript community is known for its rapid pace of change and the constant introduction of new libraries, frameworks, and tools. While this can drive innovation, it can also lead to fragmentation and inconsistency across projects.
The Elixir community tends to be more focused on stability, long-term support, and collaboration. This can result in a more consistent and cohesive ecosystem, where tools and libraries are more likely to work together seamlessly.
In conclusion, while JavaScript has its strengths and has undoubtedly played a vital role in the growth of web development, its dependency management and ecosystem can be seen as less than ideal from an Elixir enthusiast's perspective. Elixir's dependency management system, focus on concurrency, and community values offer a more robust, sane and secure alternative.
(How's that for "actually putting down a reason" as to why Javascript is terrible? Hey, you asked!)
Works for me! Very much matches the MO I've been using as "JS is wild, ain't it great!," so I tend to agree with the shown perspective.
I also think a huge amount of these tend to be pretty typical conservative-developer overconcern (see Yegge's Notes From The Mystery Machine Bus https://gist.github.com/cornchz/3313150), governing yourself on fear, that is probably not really as fully warranted or deserved.
But I'm also a huge fan of wild & fun & diversity. I also love that we try & do other things, that programming languages are not a Last Man Standing situation, & that we have great technical ecosystems with caring trying folks finding new ways to move forward & progress like Elixer. I look forward to seeing what lessons there prove really valuable (and perhaps aping them)! It's a choice in JS world but I do use immutable.js, for example, and it's great & as described as an advantage above. Ditto for some fp tools, but often I will mutate & use effectual/imperative styles, I often find there are significant performance or understandabity wins.
I would say, yes, the cost of talking vs snarking may be real, but it doesn't have to be this large & well examined a list as you've madd. I don't like JS, the amount of dependencies terrifies me. I don't like JS, it's too fragmented. I'd rather use Elixer, I like having a good actor model underpinning my ecosystem. Sharing some sort of tidbit can help calibrate where a person is & turn destructive contagious negativity into healthy discourse.
I forgot to reply to this comment but I did like it.
I don't actually hate JS. It's possible to write great JS. (And honestly, things like Elm do exist, and Svelte looks pretty amazing, but these also have their cost.) The failing for me is that there's nothing stopping anyone, especially a library I might decide to depend on, from writing bad JS. This was the same problem I had with Ruby. We spent all this time aiming for thread safety in our app (a whole team spent a lot of time on it) and it turns out the 2 culprits were 2 libs we depended on, because Ruby simply makes no guarantees about thread safety (and cannot, because it's mutable, thus making forking either expensive or dangerous). That and probably a few other things burned me enough to make me say "no more" and I suddenly loved the idea of a language where "thread safety" is completely a given and impossible to violate and you don't have to mutex-lock everything.
I don't think FP will ever get popular, unfortunately, unless we NEVER teach ANYONE ANYTHING but FP, because the people that pay the cost of learning the FP way are paying it because of all the ways they got burned by the non-FP (OOP, imperative, mutable) ways...
If you ever get there yourself, you have my hat-tip. And truly, it is worth the journey.