Live data from Hacker News

You Don't Need JQuery

blog.garstasio.com

131–140 of 201 posts

Re: You Don't Need JQuery

#132
Who needs an operating system if you can write your own? Then you might as well write a browser, and develop a web language for it, and then you can write your own jQuery type library in that language. Because, why not, you don't NEED to use all these excellent tools already available for which I provide no reason not to actually use them.

I'm just saying, you don't need them.

Re: You Don't Need JQuery

#133

I disagree, jQuery is awesome, even for seasoned web developers. Of course you don't need it, but it makes life a lot easier when working with XHR, events, selectors, etc. If you're worried about dependencies, you could just compile your released library with the Google Closure compile, and strip out everything you don't use. You could even set up a pipeline to produce two releases: one that has bits of jQuery embedd…

It's better to just use one of the jquery versions hosted on the google developer cdn: https://developers.google.com/speed/libraries/devguide If you link to a popular jquery version, I bet the odds of the user already having the library cached is approaching 95%+ so your dependency is essentially free as no requests will be made in that case.

Re: You Don't Need JQuery

#134
I started to use Angular instead of jQuery. It comes with jqlite and a lot of the stuff I would use jQuery for (e.g. form validation) can still be easily done.

Re: You Don't Need JQuery

#135

This guy's argument is strikingly similar to that of the one made by those people who are anti-Apple, despite the fact that working with Apple products is a commonly pleasant experience, simply for the fact that they're Apple. Just because a lot of people use something that they're not being forced to use doesn't necessarily mean that they've been "tricked" into doing so.

Using Apple products is a pleasant experience. Using jQuery is to avoid learning how to code while purporting that it makes things easier cross browser. Of course, if that were the real reason, we would also have cQuery and c++Query and so on but, instead, we just learn how to code.

Yeah, and for that matter, why are we writing C anyway when we could just write everything in assembly? Lazy!

Re: You Don't Need JQuery

#136
If we've heard this argument once we've heard it a million times. Of course you don't need jQuery but unless you are writing an internal-only app and plan on writing everything from the ground up (all your auto-completes, multi-selects, etc) then you do need jQuery.

I am not a fan of a lot of the code that I've seen written with jQuery but jQuery itself is not evil anymore than PHP is evil because people do stupid stuff with it. If you use jQuery correctly it is an invaluable tool that makes your like 100x easier.

Event handling alone, I want to puke when I see the default way to do this, way too much typing, way too verbose. If I had to write that multiple times a day then I would probably create a helper function to abstract it away and I'd be on my way to building my own jQuery. No thank you, I'll take the one that's battle-tested and maintained.

I'm getting sick of seeing this argument, if you work in a bubble then sure, be my guest (I'll be laughing at all the extra typing you will be doing) but if you plan on deploying your code to the real world? Just use jQuery and save yourself a headache.

Re: You Don't Need JQuery

#137

Earlier quoted context omitted.

Yes, why use a tried and tested tool that can be incorporated into your site and served efficiently with just a single extra line, when instead you could make building your site more complicated than compiling an entire Linux distribution from source, spend days choosing between a bunch of almost identical micro-libraries for every little thing you need to do, and lock yourself into a proprietary framework that will…

make building your site more complicated than compiling an entire Linux distribution from source http://browserify.org/ Browserify is not at all complicated. spend days choosing between a bunch of almost identical micro-libraries for every little thing you need to do Just search npm and pick the one that is being used the most. lock yourself into a proprietary framework that will be considered legacy code as soon as…

The problems that npm and browserify solve are at the level of builds and package management. You could use any number of trendy frameworks and tools on top of this.

Right. But last week it was RequireJS, not Browserify. Today, as well as NPM, we have Bower and gem and pip and however many other package managers. Last week it was Angular, this week it’s React, and next week maybe it will be Web Components. Last week it was Grunt, this week it’s Gulp, and next week who knows?

The list goes on, but it always seems to be the same basic argument: for some reason, we are told, we suddenly need 73 different tools and templates and scaffolds and packages and boilerplates just to start a simple project. It’s long past time we stopped accepting that kind of rhetoric as if it’s some unquestionable truth. Ultimately web pages are still primarily made of the HTML, CSS and JavaScript that you serve to browsers. Everything else should have to pay its way, and there are always costs in complexity and maintainability when you introduce any external dependency into your project.

Now just to be clear, I am absolutely not saying don’t use good tools. If you are working on a large, complicated project, of course you should be systematic about it and control your dependencies and automate your processes. Even if you’re only working on a small project, low cost tools like jQuery or SASS might more than pull their weight. But it’s important to choose tools that fit the problem and offer a good cost/benefit ratio. Most web projects aren’t large and complicated, and many don’t need elaborate build processes and package management schemes at all. There is no good reason that such projects should give up on a simple, effective tool like jQuery just because you can also solve the same problems now with heavyweight tools like React and Browserify and some combination of NPM-managed packages.

Re: You Don't Need JQuery

#138
post #37

Earlier quoted context omitted.

Yeah, the problem with jQuery is all that other stuff that nobody uses and backwards compatibility with browsers nobody supports. A "lite" jQuery with the same familiar API but a stripped-down featureset for higher performance and smaller size would be nice.

Just use the CDN copy of jquery and it will be cached in the users browser already since so many websites already use it.

Not really, the cache-hit benefit is a myth. Too many CDNs, too many versions of jQuery in use, cache's too small...

So ..using jQuery via a CDN, depending on which you use you have a 1 in 119, or 1 in 833 chance of the user having a cached copy. http://www.i-technology.net/2013/11/the-myth-of-cdn.html

more data: http://www.stevesouders.com/blog/2013/03/18/http-archive-jqu...

There are valid reasons to use a CDN (get the scripts closer to the end user, offload the data transfer costs to the CDN provider, etc) but it isn't due to the potential for a cache hit.

Re: You Don't Need JQuery

#139

Imperative DOM manipulation is a pain one way or another. React does a great job of alleviating this pain by allowing for declarative DOM manipulation, but it would be great to be able to do this without needing the rest of React.

You might be interested in the virtual-dom and vdom-thunk NPM packages, which are used in mercury:

https://github.com/Raynos/mercury

See also Raynos's "NPM-style Frontend" presentation:

https://www.youtube.com/watch?v=8w0_Xw7PPFQ

Post reply on HN