• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Carey Brown
  • Stephan van Hulst
  • Tim Holloway
  • Peter Rooke
  • Himai Minh
  • Piet Souris
  • Mikalai Zaikin

jquery vs pure javascript

Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bear Bibeault wrote:

san nav wrote:But, I dont want to use JQuery.

Why not? Do you enjoy re-inventing the wheel? if not jQuery, why not Dojo? Or YUI?

Writing complex script on pages without the aid of one of the useful libraries is not wise. These tools abstract all the complexity and cross-browser nuances away for you.

If you write Java, do you use the Java collection classes? Or have you implemented your own List and Map implementations? Do you write your own JDBC driver?

Availing yourself of the available tools is a good practice.

I know this is a year old post, but it does shows high in google, and since I registered just to answer the last post, well, I hope my comment will stay here

So, Bear Bibeault, why do you compare Jquery with Java when it has nothing to do with each other? Javascript only bears the name Java in it but it's like comparing your bicycle with Ferrari - and the common between them is that both have wheels - but they are still not comparable.

Of course in Java you will use libraries that are already made by others! Same in C#, .NET, Visual Basic, etc. because they are real programming languages which can do real stuff, like database, network, file access, etc. But Javascript is only for browsers and can't do database, networking or file access without the help of PHP or ASP. Not just that it can't do, but it's also unsecure for those kind of things. It's mostly here for making our browsing experience faster and more dynamic. Complex things? You can't do much with Javascript. With PHP or ASP you could, and using ready made libraries for some complex stuff is advisable there. But for JS you don't need that. All you need is a little knowledge and 2 browsers: Mozilla and IE. And to tell you the truth, what works in IE works everywhere else

Honestly, I also don't use JQuery. It does makes life simpler, but loading a 90kb file on a page just to do simple stuff like opening a popup page with a customized page, or adding some dynamic things to a website is a waste of bandwith. Of course, you can load it from another server, like google, but the problem is, what if google's server is busy, so your site's loading will late because of that?

Reinventing the wheel? Not in the case of jQuery. Because while many people do use it, Javascript was here first, and I enjoy building my own functions the way I want to while achieving the same visual effects like you can with jQuery. And .... my js file is lot smaller than jQuery and a lot easier to read
Oh, and I forgot: you only include jQuery to your site + you still need to write your own functions so .... try building a site without jQuery and you will see how smaller it is and will give you a lot better knowledge of Javascript.

And last but not least, why do you think that Michelin has better tires than others? Because they reinvent their tires over and over, while others only use the already established rules to create tires. Think about all the great people in history. If they followed the already set rules, they would never be great. You can be great or different than others only if you change the way you do things or the way you think. And by reinventing the wheel you not just understand more how the wheel was created, but you also see what possibilities are there and how to improve that wheel. Ask any car factory how they come up with better engines, better cars - by reinventing them. Going back to basics to see what else can be done, because the current rules have limitations and they want to bypass them. Jquery also have limitations, while pure Javascript has no limitation. I mean, jquery has limitations because it's an already established set of functions and rules while javascript is only a code pieces which you can put together any way you like.
So DO go back to basis and reinvent the wheel because that's the only way you will be different than others and have a better website than others

Sorry for the long post ..... I just had to throw this out of me Not with anger but with joy. Hopefully nobody feels attacked
author & internet detective
Posts: 41656
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to CodeRanch!
I've split this conversation from another thread. It's a nice discussion to have, but isn't about JavaScript and changing buttons per se so I'd rather it be a separate topic. With it's own subject. [you can suggest a different subject line if you like]

On the points.
1) Bear is comparing JavaScript to Java because many people at coderanch know Java. He could have easily compared JavaScript to .NET or Perl or Python or any other language.
2) JavaScript IS a real language. I think this is a key point. Just because it runs in the browser doesn't make it a lesser language. (It can run on the server too, but most people don't use it that way for what it is worth.) I remember when I was learning JavaScript 10-15 years ago. At that point, there weren't JavaScript libraries (that I know of) unless you wrote them yourself. As browsers/HTML gain more functionality, JavaScript logic became more complex and reusable libraries were born. AJAX further increased reuse. For example, take a look at gmail. That's a large application written in JavaScript. (or GWT - I don't remember - but that generates JavaScript and is still a library)
3) What works in IE does NOT run everywhere else. I've been burned by that enough times to always test in at least two browsers.
4) jQuery is loaded from a CDN (content delivery network) - google's server as you noted. It's then cached on your browser. This turns out not be a huge performance hit.
5) Reinventing can be good. Once the principles are understood. Most of us aren't at the JavaScript level as the contributors to jQuery. Reinventing our own could easily be slower/worse.
6) I don't want to have "better" confirmation box than everyone else. I want it to be what users expect.

It's fine for you to choose not to use jQuery. But it's also valid for Bear to recommend it.
Posts: 67706
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Jeanne is correct -- I'm not sure why you think I was confusing Java with JavaScript; it was just a comparative example. (Having written five books on JavaScript, I think I know the difference.) My point is that, in any language, one ignores the tools that are available to them to their own detriment.

Is it possible to re-invent the wheel? Sure. If no one did, there'd be no progress in inventing better wheels. But not everyone has the time or the expertise to build a better wheel.
Posts: 297
Android Firefox Browser Fedora
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'd go further than Jeanne and Bear's very polite responses: the attitude demonstrated in the opening post is one of the reasons why JavaScript has the reputation it does. Developers who view as just a toy to be used in the browser seem to forget everything they know about good software engineering practices as soon as they get near a web front end. Good engineering is good engineering, you don't get a free pass to write crappy code because it's 'just' the front end.

On the practical front, if you're really that worried about the 32.1k over the wire cost of loading jQuery, have a look at some JavaScript micro-frameworks.
    Bookmark Topic Watch Topic
  • New Topic