 |
Account Login
|
 |
 |
Latest Articles
|
 |
 |
IRC Channel
|
 |
 |
Associates
|
 |
 |
Associates
|
 |
|
 |
|
 |
|
 |
08-10-2009, 03:13 PM
|
#1 (permalink)
|
|
The Wanderer
Join Date: Aug 2009
Location: Pretoria, South Africa
Posts: 11
Thanks: 0
|
Basics or jQuery?
Just something I thought to myself, reading another thread on this same forum, that I would like to share is the discussion surrounding whether people that are new to javascript should start with the basics, not programming basics but rather basics on how to manipulate the DOM, or go straight into jQuery.
Now for those of you that do not know, jQuery is a popular javascript library that makes the use of javascript as a programming language "easier", in some cases I fully agree it does, but as with all libraries or frameworks this comes at a disadvantage, being the size of it, where sometimes all you need to do is hide a div, which can be written in a total of 1 line of code.
<rant>Every time you then need to go hide that div, this whole library will be loaded, yes it is small but the fact still exists that using the library for something so simple is bloating websites/applications all over the net, just to have a quick look at the uncompressed version of the latest jQuery library which is 120kb, sounds small hey? Coming in at 4327 lines of code it really is not that small.</rant>
Without going completely off topic, I reckon a user should first know what the DOM actually is, what are elements, how do you manipulate the DOM, what is ajax actually, before jumping into a library which will help reduce the amount of code for larger/complex web applications.
So, basics or jQuery?
|
|
|
08-10-2009, 03:40 PM
|
#2 (permalink)
|
|
The Addict
Join Date: Jun 2008
Posts: 335
Thanks: 2
|
Basics obviously, you can't fully take advantage of jQuery without having an understanding of DOM.
|
|
|
|
08-10-2009, 04:11 PM
|
#3 (permalink)
|
|
Moderateur
Join Date: Apr 2007
Posts: 1,393
Thanks: 5
|
I'd go so far as to say they should learn much more than merely the basics before diving into any of the frameworks available. Unless they're the type who really don't want to learn the language but rather just get the job done.
Would you recommend someone jumps right in using the Zend Framework, Symfony, etc. before knowing the first thing about PHP? I certainly wouldn't!
|
|
|
|
08-10-2009, 04:45 PM
|
#4 (permalink)
|
|
Super Moderator
Join Date: Sep 2007
Location: Near you.
Posts: 791
Thanks: 241
|
Sometimes, learning the hard first can be a good thing.
But can also damage the learning process.
And in the end you end up beeing overwhelmed,
so start small and go up slowly
-CF
|
|
|
|
08-10-2009, 05:26 PM
|
#5 (permalink)
|
|
The Acquainted
Join Date: Jul 2009
Location: Surrey
Posts: 105
Thanks: 1
|
Definitely learn php before zend framework and definitely learn the basics of javascript before jquery.
|
|
|
|
08-11-2009, 09:00 AM
|
#6 (permalink)
|
|
The Prestige
Join Date: Oct 2007
Location: Manchester, UK
Posts: 854
Thanks: 32
|
Basics are very important, you need to know how javascript fully works at a relatively advanced level (at least know how its object model works), this is because jQuery uses a lot of advanced level javascript concepts that may just seem like 'black magic' to people without the necessary grounding in the language. This limited understanding can lead to bad and somewhat slow code.
__________________
mysql> SELECT * FROM `users` WHERE `users`.`clue` > 0;
Empty set (0.00 sec)
|
|
|
|
08-11-2009, 12:55 PM
|
#7 (permalink)
|
|
The Wanderer
Join Date: Aug 2009
Location: Pretoria, South Africa
Posts: 11
Thanks: 0
|
Quote:
Originally Posted by JaoudeStudios
Definitely learn php before zend framework and definitely learn the basics of javascript before jquery.
|
Contradicting yourself a bit then aren't you?
Could I get a href properties with javascript?
|
|
|
08-11-2009, 01:57 PM
|
#8 (permalink)
|
|
Wizard
Join Date: Sep 2007
Posts: 1,299
Thanks: 17
|
You can learn how to use jquery without knowing DOM, but you will not understand what is happening until you know how jquery works.
|
|
|
|
08-11-2009, 04:05 PM
|
#9 (permalink)
|
|
The Addict
Join Date: May 2009
Posts: 287
Thanks: 5
|
Quote:
Originally Posted by Village Idiot
You can learn how to use jquery without knowing DOM, but you will not understand what is happening until you know how jquery works.
|
JavaScript is essential to knowing how to do JQuery scripts that are beyond trivial.
|
|
|
|
08-11-2009, 04:16 PM
|
#10 (permalink)
|
|
The Wanderer
Join Date: Aug 2009
Location: Pretoria, South Africa
Posts: 11
Thanks: 0
|
Quote:
Originally Posted by adamdecaf
JavaScript is essential to knowing how to do JQuery scripts that are beyond trivial.
|
Agreed, using jQuery without knowing what it is actually doing is a disaster waiting to happen, true you get extensions that make your life easier but what happens when you need to change something in that extension?
Last edited by devnull : 08-11-2009 at 04:44 PM.
|
|
|
08-11-2009, 04:19 PM
|
#11 (permalink)
|
|
The Addict
Join Date: Jun 2008
Posts: 335
Thanks: 2
|
Nay the disaster is when you do this:
javascript Code:
$("#imgID").attr('src', 'http://google.com/img.png');
instead of
javascript Code:
document.getElementById('imgID').setAttribute('src', 'http://google.com/img.png');
|
|
|
|
08-11-2009, 04:20 PM
|
#12 (permalink)
|
|
The Addict
Join Date: Jun 2008
Posts: 335
Thanks: 2
|
Nay the disaster is when you do this:
javascript Code:
$("#imgID").attr('src', 'http://google.com/img.png');
instead of
javascript Code:
document.getElementById('imgID').setAttribute('src', 'http://google.com/img.png');
I've seen the jQuery library - uncompressed - be called into web apps for the sole purpose of changing some attributes.
|
|
|
|
08-11-2009, 04:30 PM
|
#13 (permalink)
|
|
The Addict
Join Date: May 2009
Posts: 287
Thanks: 5
|
Yep, I've actually found JS very simple compared to JQuery.
|
|
|
|
08-11-2009, 04:37 PM
|
#14 (permalink)
|
|
The Wanderer
Join Date: Aug 2009
Location: Pretoria, South Africa
Posts: 11
Thanks: 0
|
Quote:
Originally Posted by Enfernikus
I've seen the jQuery library - uncompressed - be called into web apps for the sole purpose of changing some attributes.
|
More than often :/
Just for interest sake anybody want to benchmark that? Still at work will do when I get home
|
|
|
08-12-2009, 10:19 AM
|
#16 (permalink)
|
|
Moderateur
Join Date: Apr 2007
Posts: 1,393
Thanks: 5
|
Quote:
Originally Posted by Enfernikus
I've seen the jQuery library - uncompressed - be called into web apps for the sole purpose of changing some attributes.
|
If you bring in the library from some CDN then the impact might be bearable: the main example being loading jQuery from the Google AJAX Libraries API. The idea being that the client would hopefully already have the file cached.
|
|
|
|
08-12-2009, 10:25 AM
|
#17 (permalink)
|
|
The Acquainted
Join Date: Jul 2009
Location: Surrey
Posts: 105
Thanks: 1
|
Its difficult to find a balance. But some understanding of javascript is need before using jQuery. For example conditional statements in jQuery are still javascript.
|
|
|
|
08-12-2009, 11:19 AM
|
#18 (permalink)
|
|
The Addict
Join Date: Jun 2008
Posts: 335
Thanks: 2
|
Quote:
Originally Posted by Salathe
If you bring in the library from some CDN then the impact might be bearable: the main example being loading jQuery from the Google AJAX Libraries API. The idea being that the client would hopefully already have the file cached.
|
You've a good point but the idea is not the fact that the file must be downloaded and might affect load times but rather that for the simple task of changing attributes the library was needed. This was the only JS on the site ( Intranet tool, the company wasn't big on facy UI's internally )
|
|
|
|
08-12-2009, 01:37 PM
|
#19 (permalink)
|
|
The Prestige
Join Date: Oct 2007
Location: Manchester, UK
Posts: 854
Thanks: 32
|
Its all about balance, you wouldn't use the Zend framework for a site with static content, would you? In the case above, yes jQuery is probably overkill.
Quote:
|
Yep, I've actually found JS very simple compared to JQuery.
|
All very well and good for simple examples like that but when you start doing some advanced standard compliant DOM stuff with native JS, it gets very painful indeed (especially when redmond is in the equation) jQuery takes alot of the pain away from that!
__________________
mysql> SELECT * FROM `users` WHERE `users`.`clue` > 0;
Empty set (0.00 sec)
|
|
|
|
08-12-2009, 03:10 PM
|
#20 (permalink)
|
|
The Acquainted
Join Date: Jul 2009
Location: Surrey
Posts: 105
Thanks: 1
|
jQuery takes the pain away from cross-browser issues too! That in itself is worth a lot! (especially because IE is poo - any chance i get to have a dig at windows - with valid reason ofcourse :) )
|
|
|
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|