Live data from Hacker News

Drop jQuery as a dependency from Rails

github.com

81–90 of 123 posts

Re: Drop jQuery as a dependency from Rails

#81
post #76

There was an article about a week ago that makes the claim that Rails is tailor-made for Basecamp. This single comment absolutely confirms that point of view: https://github.com/rails/rails/issues/25208#issuecomment-222...

Lots of websites have those browser requirements. Many of them aren't written in Rails. Care to explain your "absolutely confirms" logic?

Lots of websites require a browser that was released in the last 2 1/2 years?

I think you're seeing the web through SV tinted glasses.

Re: Drop jQuery as a dependency from Rails

#82

As a web dev for the last 15 years or so, this is amazing news. The browsers are finally getting to a point where the pain jQuery solved, is going away.

jQuery helps with browser quirks, though. Search the below file for the string "// Support" to see what I mean. Yes, there are a lot of entries for older browsers, but there are also a lot of entries for relatively recent browsers too. https://github.com/jquery/jquery/blob/3.0.0-rc1/dist/jquery....

It does help with browser quirks, but if you aren't supporting <IE10, then you really don't need it. I've made it a point to pull out jQuery from every project I have. Nowadays, I can test in Chrome as I develop and then test any other browsers at the very end and I rarely have any browser specific bugs. Crazy how far web dev has come.

Re: Drop jQuery as a dependency from Rails

#83

Rails should stop messing with Javascript all together. Drop JQuery, CoffeeScript, TurboLinks and what not and let the users decide what to use, make it optional. Rails shouldn't require a JS engine in order to run.

And asset-pipeline altogether. Replace it with a simple optional gem to integrate with Webpack.

For all the faults of the assets pipeline, it's dead simple to use out of the gate for a lot of apps. We use webpack and it's a pain sometimes; there's no documentation and when something breaks, good luck finding a fix on GitHub issues or StackOverflow.

Re: Drop jQuery as a dependency from Rails

#84
post #31

Earlier quoted context omitted.

This is one of the best things about Django - outside the admin interface it's not opinionated about your frontend setup.

I've found this problematic in Django: How to integrate a good JS frontend that isn't at odds with the built-in templating system. Offloading the templating to React (eg. node / JSX) seems like a good bet -- but then your Django app is little more than a REST API. I'd love to see some good, practical examples of a full-featured (ie. integrated) Django app with a js frontend. Pointers welcome!

Python is a good language for writing glue code. Django abstracts a lot away with its ORM. If you stick to just providing an API, you'll still get some help from it.

Now is it better than assembling a little stack yourself with an ORM + a micro web framework? Well, perhaps not - though you still got the admin which can be handy. But next time you're going to need do to a project that won't benefit at all from being a SPA, Django will be helpful.

You can turn the question on its head - if you're just providing a relatively thin API, whatever you choose probably won't be terribly important as long as it is not something fragile that will be gone in 2 years. So don't invest too much thought into it.

Re: Drop jQuery as a dependency from Rails

#85

Rails should stop messing with Javascript all together. Drop JQuery, CoffeeScript, TurboLinks and what not and let the users decide what to use, make it optional. Rails shouldn't require a JS engine in order to run.

The new TurboLinks is one of the best things about Rails 5, though. You can basically get UX comparable to an SPA with mostly server code. As for coffeescript, you can just remove the gem and it'll use regular JS. https://www.nateberkopec.com/2015/05/27/100-ms-to-glass-with...

Sadly, you can't just remove the gem anymore. At least not if you want to use ActionCable. ActionCable generators only generate Coffeescript.

Re: Drop jQuery as a dependency from Rails

#86

Earlier quoted context omitted.

Of course "not opinionated" in this case is an euphemism and really means that Django doesn't help you at all and so you have to suffer the incomplete and abandoned middleware of others to have something that resembles an asset pipeline. And that's actually odd, because both Rails and Django are frameworks born for building frontends to MySQL databases, which means these frameworks really are about HTTP 1.1 frontend…

Take away templates and add Django Rest Framework and you have a very capable platform for building large CRUD APIs complete with models, permissions, serializers and so forth. Is it the best solution when you just want to stream data down a socket? No. That doesn't mean it's useless for many other things. If I'm going down the SPA route I'd just build the frontend separately using ember-cli or webpack or some other…

> If I'm going down the SPA route I'd just build the frontend separately using ember-cli or webpack or some other "native" solution and forget any asset pipeline.

It's a good approach. There is no need to treat front and back-ends as a single application, bound by the same rules - they use completely different stacks and completely different tooling.

Re: Drop jQuery as a dependency from Rails

#87
post #28
post #8

Earlier quoted context omitted.

So did you do JS development back in 2006 without jQuery?

The first few years I did PHP without much client side scripting. Then ExtJS, then a short stint with Ember and after that React.

Ah, ok, so you're not a 10 year JavaScript developer, that's very different thing. If you were doing DOM manip 10 years ago without jQuery / MooTools / Dojo / YUI you would be someone that loves pain.

Re: Drop jQuery as a dependency from Rails

#88

Earlier quoted context omitted.

This is one of the best things about Django - outside the admin interface it's not opinionated about your frontend setup.

Of course "not opinionated" in this case is an euphemism and really means that Django doesn't help you at all and so you have to suffer the incomplete and abandoned middleware of others to have something that resembles an asset pipeline. And that's actually odd, because both Rails and Django are frameworks born for building frontends to MySQL databases, which means these frameworks really are about HTTP 1.1 frontend…

Re: websockets/push, another thing you can do is run two frameworks side by side. A load balancer like HAProxy can be used to unify the two, if needed.

For example, at my previous job we used Django for our main request/response API and Tornado for our push API. Later on, the Tornado part was rewritten in Java. Given the Django experience of the team, this architecture proved to be easier to maintain than having to rewrite the entire API, since there were far more request/response endpoints than push endpoints.

Nowadays there's Pushpin, which I created after the above experience.

Re: Drop jQuery as a dependency from Rails

#89
post #76

Earlier quoted context omitted.

Lots of websites have those browser requirements. Many of them aren't written in Rails. Care to explain your "absolutely confirms" logic?

Lots of websites require a browser that was released in the last 2 1/2 years? I think you're seeing the web through SV tinted glasses.

Sure, since all major browsers auto-update now. This has been a thing for years.

https://technet.microsoft.com/en-us/library/dn531055.aspx

http://meta.stackexchange.com/questions/56161/which-browsers...

https://support.google.com/mail/answer/6557?hl=en

https://support.google.com/a/answer/33864?hl=en

http://www.amazon.com/gp/help/customer/display.html?nodeId=2... (notable exceoption for IE8, would love to know the reason)

etc.

Re: Drop jQuery as a dependency from Rails

#90

There was an article about a week ago that makes the claim that Rails is tailor-made for Basecamp. This single comment absolutely confirms that point of view: https://github.com/rails/rails/issues/25208#issuecomment-222...

Rails is a joke and @dhh is only making it worse. I'm disgusted by his choices. A lot of good devs are moving away from it for several reasons.

For me, it was the amount of magic involved in everything. I'm just glad I gave up and moved onto other things.

Post reply on HN