Re:You might not need jQuery (2014)
by human on Thursday January 14, 2021 @12:50AM
(#25772613)
I’d be careful about premature optimization. If you can write your code 2x faster by using jQuery, by all means do it. Eventually, if needed, you could rewrite your JS to be free of jQuery, but it would not be a priority for me. Dev speed if more important than load speed for me.
[ Parent
| on HN ]
Re:You might not need jQuery (2014)
by austincheney on Thursday January 14, 2021 @05:16AM
(#25774592)
That’s not premature optimization:
https://en.m.wikipedia.org/wiki/Program_optimization#When_to...
If your code can execute 10x faster without jQuery then the optimization is not premature. If a developer takes twice as long to write any code the problem isn’t optimizations at all.
> If your code can execute 10x faster without jQuery then the optimization is not premature.
One could argue that it is premature if the code doesn't _need_ to run 10x faster.
Re:You might not need jQuery (2014)
by austincheney on Thursday January 14, 2021 @09:45AM
(#25776863)
One could also argue that driving to work is premature if you have two perfectly good legs. All ridiculousness aside a person can invent any absurd excuse to hide from the common practices of their profession.
"optimization - an act, process, or methodology of making something (such as a design, system, or decision) as fully perfect, functional, or effective as possible"
If you optimize process of delivering feature to the end user then using JQuery is optimization and not premature. It does not have to be optimization of runtime/load time.
Re:You might not need jQuery (2014)
by abiogenesis on Thursday January 14, 2021 @01:33AM
(#25772908)
What we need is a Jquery-to-VanillaJS transpiler.
Uh, what do you think jQuery is written in?
Re:You might not need jQuery (2014)
by abiogenesis on Sunday January 17, 2021 @06:12PM
(#25816238)
jQuery is written in JS, but if your code is using jQuery functions you are not writing "vanilla JS" anymore. Otherwise we wouldn't need the term "vanilla JS".
What I meant was inlining the jQuery calls to their equivalent JS snippets, removing the need for including a 80K library if you are not overly dependent on jQuery. It was also a tongue-in-cheek comment.
Re:You might not need jQuery (2014)
by noisem4ker on Thursday January 14, 2021 @09:26AM
(#25776603)
The point is doing the translation on the server.