Welcome back.
This is going to be a quick video on the reasons that you should use Jay Querrey and some reasons that
you might not want to use Jake Querrey.
So in the intro video I summarized Jake Query as a javascript library that helps us do a lot of the
things that we do already.
And it just makes them easier.
So you might be asking yourself a question after hearing that which is why would we not always use a
query.
It seems like if it makes life easier and it helps us with all the common dominant mutation features
we should just always use it.
The truth is that it's a little bit of a debate in the developer community right now so I'm going to
start by talking about some of the reasons for using a query.
Then I'll talk about some reasons why you might not want to use a query and then I'll also talk about
my own opinion and my experience teaching people to program where Jay Querrey fits in best.
Before we start here I do want to point out this Web site you might not need Jay Querrey I'm showing
this to you for two big reasons.
The first of which is that it demonstrates that everything we can do with Jay Querrey we can do without
it.
That's the point of this website is to show common things.
Jay Querrey like hiding and Allaman how you would do them without a query and you'll see that a lot
of them are really similar.
And on a lot of them Jay curry isn't much shorter but on some of the features like Ajax this is a lot
longer over here without Jay query.
The second reason I'm showing the site to you is that the very fact that there's even a site called
you might not need Jay query is a testament to the debate that's currently ongoing in the developer
community and this is just one example of a site that is questioning that you might not need a query
.
There are hundreds and thousands of blogs and articles and tutorials out there that will tell you you
have to use a query or you should never use a query and it's very hotly contested.
So let's dive deeper into that debate and talk about why you should use J queery so why you stay quiet
.
The original reason that it was created is that Dom API all the methods we've been using Document dot
of course Lechter get element by ID.
All of that used to be considered broken.
So the whole goal of Jay query was to make it easier and quicker to use the DOM API by using Jay Querrey
which acted as an interface to the broken Dom API.
It also makes your code clearer and shorter as you saw here.
You know doing something like this without a query is three or four times the amount of code as it is
using Jey query so it makes it clearer and shorter.
It's easy to use as well.
It has built in cross-browser support so that means that Jay query will take care of the differences
between a property that works in Internet Explorer 9 and one that works in Internet Explorer 8 and it
will take care of all that cross-browser support.
Which is kind of messy.
And one of the worst parts of being a web developer to be honest in my opinion at least it also provides
AJAX which we'll talk about later.
It's a subset of features that's really useful.
And the last reason on here is that lots of people use a query and I'm not just saying that because
lots of people use Jey query.
You should obviously use it too.
That's not at all what I'm saying but the fact that lots of people use Jey query means that there's
a strong community out there.
There are lots of tutorials and blog posts and stack overflow questions.
People use it all over the place and so there is a lot of materials and resources that pertain to Jay
Querrey which is great when you're trying to do something and you need help.
OK.
So we talked about why Jay queery is great and it probably sounds a little bit like Americorp at this
point.
So why would we not use it.
And the first and most important answer is that the Dom API is no longer broken so it has things that
it didn't used to have.
So for instance queery selector query selector all did not used to exist as part of Saddam Adamu API
is much easier to use.
And we've been using it so far and we've been doing just fine without a query.
The second reason is that it doesn't do anything you can't do on your own which is the whole point of
this site.
We can do everything that you would do with a query without it.
And along with that if we only wanted to use two or three methods or even 10 methods out of query we're
still including you know 100 or 200 plus different methods.
So sometimes people will call it an unnecessary dependency.
They might say that using j Curry is too heavy a tool for what you're doing.
So if you're only using Jay query for animations for instance that's a little bit overkill because there
are other tools out there that will help you only with animation while Jay queery does animation Plus
you know a hundred other things.
And and it's just unnecessary to have that much weight is what people would say.
So performance can be an issue.
It won't be in our case we won't be doing anything that really is pushing Jay Curry hard but the idea
behind that is that if someone is using Jay query and they don't know they're not familiar with the
code and the source code of Jay query and how things are written they might use a method they might
write some code that's inefficient.
That actually is slower than if they had just done it without a query.
But as I mentioned that's a little bit of a long shot for us.
And the last reason is that lots of people are moving away from J.
Cory and that's not to say that just because other people are not using Jay query that you should not
use it it's the same reason that I mentioned for Jay query.
There's great resources and tutorials and videos lots of information out there.
So you really can't go wrong.
So now we're going to spend some time discussing my own opinions on this and in particular my experience
teaching people to program with Jay Querrey and without it.
When I first started teaching people to program and teaching people to become web developers I would
start with H Tim L and then C S us and then I would go straight to Jacqui.
So I wouldn't do any of the stuff that we've been talking about in the last few units.
I would teach events.
I would teach selecting and manipulating through Jay query but I wouldn't show students how to do that
with vanilla Javascript.
So vanilla Agellius or plain G-S just refers to writing javascript without a query.
So I didn't used to do any of that in the course.
I would start with a query and what I realized is that the developers that I was producing in the class
were great developers but if you took Jay Querrey away if they went to a company that was deciding they
weren't going to use a query which happened more and more and more students would come to me and tell
me this you know my new job is awesome except they don't use Jay Querrey just so you know.
And I got that feedback a lot and I realized that the students were dependent on Jay queery obviously
by the end of the class they were good enough were they could go learn Fenella Yes and they could they
could write code without Jay query.
But the point is that their knowledge was centered around a query centric way of writing code.
So after teaching people Jay Querrey first for a few classes I change things around and I started by
teaching them vanilla javascript Dom manipulation first.
So the things that we've been doing up until this point and then I introduced J query afterwards once
they had a solid conceptual foundation of how events work and how selecting and manipulating works and
all of that that Jay Querrey can help us with.
I wanted students to understand how Jay Querrey was doing all these things behind the scenes.
After teaching this approach of vanilla ice first and then Jay queery later and doing that for a few
classes and watching those students graduate I realized that we were producing much much stronger javascript
developers.
It wasn't just the fact that my students could take some code and write it in a query and also write
the equivalent code without a query.
But more importantly I noticed that my students had a much stronger conceptual foundation of the Dom
and Dom and violation so their foundation wasn't built on Jay Querrey which is one way of doing it.
Their foundation was built on the concepts underlying J query underlying analogy.
Yes.
So its a more unified approach where students understood at a deeper level how things worked and they
saw on one side we can do this with a query and on the other side we can do it without a query rather
than structuring their conceptual framework around Jay query.
They structured it around the general Dom and the concepts of DOM manipulation.
So that was a long winded way of sharing my opinion on this issue.
I've come to the conclusion as a developer and also as an educator more importantly that its worth knowing
how to do things without a query and also how to do them with a query.
So weve seen how to do them without it and now going forward we're going to see how to do things that
Jay queery way