This resonates so much. I support some JS packages but I often wonder how anyone gets anything done in general on the JS side, and why people seem to accept the state of affairs. I'm spending most of my time with Ruby and it is night and day.
even #javascript agrees to this.
To be honest, picking up anything JS related was easy for me. I love npm, I love grunt (actually gulp now) compared to what ruby brings to the table ...
I don't have time to go into much depth right now, but basically the ascendent languages don't seem to offer many compelling technical advantages. For example, I've yet to hear a compelling reason why JS makes a better serverside language than Ruby for most use cases. To be fair, Node and some of the JS libraries for a long time offered advantages over the Ruby ecosystem for things like websockets (EventMachine used to swallow stack traces in a really annoying way). But that has more to do with the ecosystem than the languages themselves.
I think part of the problem had to do with how dominant Rails was/is in Ruby. I wish a framework that better catered to emerging app design trends had gotten traction in Rubyland in, say, 2012.
As for specific complaints about JS, well, it's a perfectly fine language, but I don't think it's an improvement in any way over Ruby. It has a number of quirks and compromises - prototype inheritance, basically no support for modules, clumsy typing, to name a few - which people have been patching over and working around in lots of different ways over the years. You end up with a forest of different solutions to things that wouldn't have been a problem in other languages. Now some fairly dramatic changes are being introduced, which is probably good, but it means the ecosystem is even more complicated. Working with the JS ecosystem feels like working with a poorly maintained legacy codebase - there are lots of places where people have come up with workarounds to things that shouldn't have been a problem in the first place; it makes you tired just thinking about all the mental energy spent solving all the little unnecessary problems.
The strange thing about this is that I've found that both make great additions to my toolbox, and when making my language choice I don't pick JS or Ruby so much as I pick Node or Rails/Sinatra and I don't do the same things with each stack.
I've long gotten past worrying too much about languages Ruby and JS are so close to each other that switching between the two is a frictionless process.
Here is what bothered me with JS and it might sound very stupid:
The idea to have a node_modules that has tens of thousands of folders/files for the simplest package that I needed to install. Ruby has gems, but they have few files, I can easily know where to go to understand how something works or add a debugger.
But just trying to read the name of all those seemed for me always like a task that I dont want to do.
The language itself letting aside some warts is good, can be enjoyed and good code maybe can be written.
I welcome the slow transformation of Javascript into Ruby. Every single thing in there is already a thing in the Ruby ecosystem. Convention over configuration. The careful, but automatic dependency management. Principle of least surprise.
All things I didn't know how much I relied on until I moved to NodeJS and found them non-existent.
I'm the lead developer on Volt. The goal here isn't to keep people from learning JS. I've been doing JS development since long before I found ruby. Just some thoughts on it I had been working on for a blog post:
In web development today, JavaScript gets to be the default language by virtue of being in the browser. JavaScript is a very good language, but it has a lot of warts. (See http://wtfjs.com/ for some great examples) Some of these can introduce bugs, others are just difficult to deal with. JavaScript was rushed to market quickly and standardized very quickly. Ruby was used by a small community for years while most of the kinks were worked out. Ruby also has some great concepts such as uniform access, mixin's, duck typing, and blocks to name a few. While many of these features can be implemented in JavaScript in userland, few are standardardized and the solutions are seldom eloquent.
Uniform access and duck typing provides us with the ability to make reactive objects that have the exact same interface as a normal object. This is a big win, nothing new to learn to do reactive programming.
--
Also, just as a side note, Opal does a great job of compiling ruby to JS. The code is easy to understand, supports source maps so chrome for example can bring up your ruby code in the console and show line numbers in the ruby code. While many gems won't work without some porting, a lot do. Opal currently runs rspec (a very complex ruby project) with only a few patches. Really though, typically front-end solutions do different things than backend solutions.
I'm not a rubyist, and I can see how this can be nice for ruby developers, but IMHO, if you need javascript - use javascript.
Why add another layer of complexity and error proneness?
What happens when a different js programmer needs to review your code? Or when you need to write some Node.js code and forgot all about syntax?
"The main motive is to have a decent standard library for JavaScript" - jQuery works just fine.
Genuinely curious, how is Ruby any better there? You can build usable front ends in either language. I care about delivering usable software. Interactive front ends for the sake of it is not a good use of effort. If your app and situation justify it, okay, but it isn’t a hard requirement like many other aspects of full stack. Just depends on what you need for good UX. A pile of Javascript isn’t a requirement there. I also stopped caring about developer titles a long time ago, that is a straw man. Real full stack devs with adequate experience in every aspect are unicorns anyway.
E: I don’t even hate JS it’s fine, just not a great investment of time for a lot of apps. And the ecosystem and getting it deployed is an absolute chore.
I switched from Ruby (after ~8 years) to JavaScript at the beginning of this year, and Ruby is a dream in comparison:
- Thanks to the proliferation of Rails and similar frameworks, most Ruby apps at least have something that resembles an MVC structure. With JavaScript, once you move past the basic TodoMVC examples you are pretty much on your own. It gives you enough rope to hang yourself, all you colleagues, and everyone in the building next door.
- The expect vs should change in RSpec is nothing compared to how fast things are changing in JavaScript. I think there are now 7 different ways of just defining a module.
- The stdlib of Ruby is pretty sensible. JavaScript has many inconsistencies (take Array.slice vs Array.splice - one modifies the original array, and the other does not), and you usually need to rely on third party libraries, or write the code yourself, to do pretty basic operations.
- The JavaScript community seems to have the opposite of NIH syndrome, so that even basic functionality is offloaded to a third-party modules (see leftpad). The project I'm working on has over 1000 modules in it's dependency tree.
Thanks... I have been thinking that the Javascript community is huge, much much larger than the Rails community. Many of the larger companies just end up writing their libraries in Javascript, then the Ruby on Rails world waits for a Rubyist to write a gem that ports their library to Rails. Again, you use Javascript when you do library integrations.
I agree completely. At the company I work for, we develop a complex client-side js app. We've got "backenders" who write Ruby, "frontenders" who write CSS + HTML, and "middlenders" who write really fucking awesome javascript.
reply