Comment by manyxcxi
10 years ago
If all you needed was a hamburger and a hidden checkbox, it would be a waste to pull in jQuery. But even still, if you were familiar with the plugin and it would take you 5 minutes to do it that way, why not? If page size or load times are excessive at some point, trim the fat then. So many things already require jQuery it's likely that the project a developer will be on already has the framework, so they may not be impacting the page size at all.
But what if you want to use a form wizard plugin, validation, a calendar picker, AJAX form posting with backward compatibility and can't use FormData because you have to support those older browsers? Well, all of those cases are covered and VERY well documented for jQuery and the different plugins you'd need. So now you're being very efficient with your time and you're making the smarter choice of giving yourself more time to focus on the problem you're trying to solve, because I doubt rolling your own calendar picker is the goal of the project.
Again, why would you build your own grid and responsive layout/break points when you can just pull in Bootstrap? If the goal of your project is to build a responsive grid, then obviously, go build it. But if your goal is to deliver a web application for desktop and mobile that may already be facing some budget or time constraints, the you're wasting your client's time and your employer's money.
If you're picking Bootstrap or jQuery you're not trying to enhance them. Your using them to jumpstart your project to build the parts that you need to build.
jQuery is bloated and big, but it (and prototype/mootools/etc) lead the way for cross browser compatibility from the time that making an AJAX request required 20 lines of code and a bunch of cascading if/else blocks to make sure which request object you were going to get. It's been around and grown to the size and usage it has exactly because it was/is useful and brought some level of efficiency.
I'm playing a bit of a devil's advocate here because I don't use jQuery for much of anything these days. I'll use it if it's already in a project I've got to touch. But I won't bring it in to a project I start unless there's a real compelling reason.
I absolutely love someone who is interested in making better, specific solutions for things, that is able to really understand the problems that come with building a grid, or a calendar picker, etc.
Once that person has built up their own library of those things, then absolutely they should use them over the jQuery and Bootstrap where it makes sense. But that is also assuming that the developer actually did a better job with what they built than what is offered in Bootstrap or jQuery. It's a bit narcissistic to think you will always be better than what a team of people has been working on for years, but it doesn't mean you're not wrong either.
Often though we are mid project when we realize we need a calendar picker or some other widget for some three forms. I would have a very serious problem with one of my developers careening off course and holding the project up for 6 days so they could build the widget from scratch when they could've gotten one of many jQuery plugins and had all three forms done in two days.
At the end, you bring in the overhead of code maintained by somebody else because you think it will let you finish faster, higher quality, or with features you otherwise wouldn't be able to build.
> But even still, if you were familiar with the plugin and it would take you 5 minutes to do it that way, why not?
Because I believe these kind of things must be solved with no JS at all, let alone a bloatware lib.
> If page size or load times are excessive at some point, trim the fat then.
jQuery is THE fat.
> So many things already require jQuery
... that I try to avoid them as virus spreaders.
> a form wizard plugin
Wut?
> a calendar picker
<input type=date>
> AJAX form posting with backward compatibility
XMLHttpRequest (probably with some wrapper functions).
> and can't use FormData because you have to support those older browsers
If a thing happens we must enable front-side file uploads for unterbrowsers without FormData, then we use our custom iframe-based solution and charge the customer additionally. Unterbrowser users must suffer, as well as those who want to support them.
> because I doubt rolling your own calendar picker is the goal of the project.
All the things we need were already rolled long before the project start.
> Again, why would you build your own grid and responsive layout/break points when you can just pull in Bootstrap?
Because my grid weighs 999 bytes. How many kilos does Bootstrap weigh?
> the you're wasting your client's time and your employer's money.
Nope, because the grid is already built.
> If you're picking Bootstrap or jQuery you're not trying to enhance them. Your using them to jumpstart your project to build the parts that you need to build.
Since they don't meet my needs 100% of the time, I would end up with some modules that do the same as the ones written from scratch, but slower and with buggy underlying code. Why would anyone prefer that?
> making an AJAX request required 20 lines of code and a bunch of cascading if/else blocks to make sure which request object you were going to get
How hard is it write it once, the way YOU see fit, and then use it all your projects? Or you believe only jQuery authors are allowed to do that?
> It's a bit narcissistic to think you will always be better than what a team of people has been working on for years, but it doesn't mean you're not wrong either.
I'm not trying to be better than them. But yes, I'm trying to do _things I need_ better than they can offer.
> At the end, you bring in the overhead of code maintained by somebody else because you think it will let you finish faster, higher quality, or with features you otherwise wouldn't be able to build.
In the real world though, "finish faster" and "higher quality" are almost always mutually exclusive.