Live data from Hacker News

This Week in Rails: jQuery no longer part of Rails, and more

weblog.rubyonrails.org

61–70 of 143 posts

Re: This Week in Rails: jQuery no longer part of Rails, and more

#61

Can anyone explain when did jQuery start to fall back in the tech era? What were its failures? It is a bit sad to say goodbye to such an old friend.

> It is a bit sad to say goodbye to such an old friend.

I see this as more of correcting a poor design decision on the part of Rails, rather than having anything to do with the relevance and usefulness of jQuery today.

Re: This Week in Rails: jQuery no longer part of Rails, and more

#62

Can anyone explain when did jQuery start to fall back in the tech era? What were its failures? It is a bit sad to say goodbye to such an old friend.

If you're just targeting modern browsers, You Might Not Need jQuery [0]. jQuery was great when dealing with browser inconsistencies and when all you had to do was wire up a few things.

If you're building a marketing website or a lightweight app, I think using jQuery is fine. But if you're building anything more sophisticated, like a highly interactive web app you'll probably skip on jQuery and just use React or something similar.

I think context is very important. Are you building something that is being maintained by multiple engineers? Does it have to accommodate regularly changing requirements? You can go really far with server-side rendered Rails and a few bits of jQuery thrown into the mix. But once you're past that point, embracing the ecosystem becomes more useful.

[0] http://youmightnotneedjquery.com/

Re: This Week in Rails: jQuery no longer part of Rails, and more

#63
jQuery was the my first language that got me into coding; I had started javascript but it became very difficult to write a short amount of code for some basic things that I was working with back in 2012.

Ruby on Rails was my first framework for developing web applications. I still use it today, but would remove jQuery as a dependency. I thought it was strange how much of dependency it was for certain things like deleting objects for Rails; I guess it was the right tool for the time.

jQuery is/was a beautiful thing in that it was a concise and fairly nice API for interacting with the DOM. I feel like it was the right tool for the time but now a lot of developers have come to learn the cost of DOM interactions especially with mobile browsers. I am not too certain about ES6 but that stems from my ignorance and not any technical concerns.

I think that while there has been strides in understanding how to make rich clients with javascript without performance issues, I do not think there has been anything as simple as using jQuery. I prefer to use Angular now or vanilla javascript if it is a small scale application and while I like/understand Angular, it took an incredible amount of time and work to properly understand what I was doing. Vanilla js can be incredibly performant, but often times I have had to write 3 times the amount of code to get something going which is a costly in time and maintenance.

jQuery was literally something that took a day for me to understand as non-developer. I hope as javascript progresses that API developers focus on simplicity and ease of use when creating the next big javascript framework.

Re: This Week in Rails: jQuery no longer part of Rails, and more

#65

I will personally continue to use jQuery for many years to come. It's a lot of power in few concise lines of code and it really makes sense. And it comes at the cost of a single request. For the small amount of JS my sites use its perfect. I don't know why everyone in thread is saying goodbye to jQuery. Are that many people coding in vanilla JS?

I think it just depends on what type of web application/site you are making.

For a simple site, it's probably not that big of a deal to hook in jQuery and write some basic scripts.

In my limited experience, if you are writing a Single Page Application, it gets really hard to rationalize changes when everything is hooked in through the DOM. It also gets pretty expensive with mobile browsers as DOM elements carry a huge list of properties and attributes; this why I think libraries like React were made as to have data change and manage state as opposed to the DOM.

At the end of the day, the end user and businesses don't care about what technologies that you use, they just want a site that works and can be delivered on time. I just think that with jQuery, there is a lot of cost in terms of making complex changes in the view that other libraries such as React/Angular/Mithril have been designed to get around. These libraries, however, do have a cost in terms of complexity that I think jQuery never really had.

Re: This Week in Rails: jQuery no longer part of Rails, and more

#66

I will personally continue to use jQuery for many years to come. It's a lot of power in few concise lines of code and it really makes sense. And it comes at the cost of a single request. For the small amount of JS my sites use its perfect. I don't know why everyone in thread is saying goodbye to jQuery. Are that many people coding in vanilla JS?

I use plain JS.

Can you give an example of a typical line of jQuery that you prefer over vanilla?

Re: This Week in Rails: jQuery no longer part of Rails, and more

#67

I will personally continue to use jQuery for many years to come. It's a lot of power in few concise lines of code and it really makes sense. And it comes at the cost of a single request. For the small amount of JS my sites use its perfect. I don't know why everyone in thread is saying goodbye to jQuery. Are that many people coding in vanilla JS?

[deleted]

Re: This Week in Rails: jQuery no longer part of Rails, and more

#68
post #55
post #28

Pour one out for jQuery! jQuery was a major productivity boost when first released but it didn't scale well and encouraged creation of tightly coupled glue code. It's decline being the result of evergreen browsers maintaining good parity where "vanilla JS" is now a feasible option and from it no longer being needed in the premier JS SPA frameworks which scales better and allows for the creation of better componentize…

> minimal complexity compared to?

The premier SPA frameworks: Angular/2, Ember, Polymer, Aurelia, Knockout,...

Fundamentally React has a one major concept "Components" which is very easy to create and JSX gives you the full power of JS without needing to learn the nuances of a crippled templating language. I use Redux to manage state which like React is simple and extremely powerful and centralizes all your App's state in clean data structures. E.g. with very little effort you can create a "Networked Time Traveller App" [1].

I also believe React's "Learn Once, Write Anywhere" approach lets you get maximum utility for your existing knowledge and decent code-reuse where you can use it to build cross-platform native iOS/Android Apps with arguably a more productive development workflow than the native iOS/Android toolkits on offer, although it's still a bit immature atm but has great momentum with a bright future.

[1] https://github.com/ServiceStackApps/typescript-redux

Re: This Week in Rails: jQuery no longer part of Rails, and more

#69

I will personally continue to use jQuery for many years to come. It's a lot of power in few concise lines of code and it really makes sense. And it comes at the cost of a single request. For the small amount of JS my sites use its perfect. I don't know why everyone in thread is saying goodbye to jQuery. Are that many people coding in vanilla JS?

I think it just depends on what type of web application/site you are making. For a simple site, it's probably not that big of a deal to hook in jQuery and write some basic scripts. In my limited experience, if you are writing a Single Page Application, it gets really hard to rationalize changes when everything is hooked in through the DOM. It also gets pretty expensive with mobile browsers as DOM elements carry a hug…

I agree with you about jQuery getting quickly out of hand if you want to create something like a one page app and you should certainly use something like React or Angular. I do use it. But to do a quick Ajax post, read some data and display a message or show and hide something jQuery is awesome. To tie a quick event listener to a dropdown and do something or to find children of some element jQuery is still few lines of code that don't even need to be cross browser tested. Using vanilla JS for these things when you can do this in few lines of jQuery code seems masochistic.

Re: This Week in Rails: jQuery no longer part of Rails, and more

#70
post #66

I will personally continue to use jQuery for many years to come. It's a lot of power in few concise lines of code and it really makes sense. And it comes at the cost of a single request. For the small amount of JS my sites use its perfect. I don't know why everyone in thread is saying goodbye to jQuery. Are that many people coding in vanilla JS?

I use plain JS. Can you give an example of a typical line of jQuery that you prefer over vanilla?

See my reply child post. But anything from tying a quick event of any kind to an element and posting a form using Ajax and consuming the response, doing quick show and hide. And the ease of implemting a million different plugins for all kinds of things, from morals to slides, in this jQuery is still a champ.
Post reply on HN