TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 08-10-2009, 03:13 PM   #1 (permalink)
The Wanderer
 
Join Date: Aug 2009
Location: Pretoria, South Africa
Posts: 11
Thanks: 0
devnull is on a distinguished road
Default 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?
__________________
~ Work is love made visible ~

Flexible Programming Tips & Tricks
Send a message via Skype™ to devnull
devnull is offline  
Reply With Quote
Old 08-10-2009, 03:40 PM   #2 (permalink)
The Addict
 
Enfernikus's Avatar
 
Join Date: Jun 2008
Posts: 335
Thanks: 2
Enfernikus is on a distinguished road
Default

Basics obviously, you can't fully take advantage of jQuery without having an understanding of DOM.
__________________
My Blog
Enfernikus is offline  
Reply With Quote
Old 08-10-2009, 04:11 PM   #3 (permalink)
Moderateur
RegEx Guru PHP Guru Top Contributor Advanced Programmer 
 
Salathe's Avatar
 
Join Date: Apr 2007
Posts: 1,393
Thanks: 5
Salathe is on a distinguished road
Default

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!
Salathe is offline  
Reply With Quote
Old 08-10-2009, 04:45 PM   #4 (permalink)
Super Moderator
Inquisitive 
 
codefreek's Avatar
 
Join Date: Sep 2007
Location: Near you.
Posts: 791
Thanks: 241
codefreek is on a distinguished road
Default

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
codefreek is offline  
Reply With Quote
Old 08-10-2009, 05:26 PM   #5 (permalink)
The Acquainted
 
JaoudeStudios's Avatar
 
Join Date: Jul 2009
Location: Surrey
Posts: 105
Thanks: 1
JaoudeStudios is on a distinguished road
Default

Definitely learn php before zend framework and definitely learn the basics of javascript before jquery.
__________________
JaoudeStudios.com | JaoudeStudios.com Forum | JaoudeStudios.com Blog
OpenSource is the road ahead...!
JaoudeStudios is offline  
Reply With Quote
Old 08-11-2009, 09:00 AM   #6 (permalink)
The Prestige
Advanced Programmer Top Contributor Good Samaritan 
 
sketchMedia's Avatar
 
Join Date: Oct 2007
Location: Manchester, UK
Posts: 854
Thanks: 32
sketchMedia is on a distinguished road
Default

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)
sketchMedia is offline  
Reply With Quote
Old 08-11-2009, 12:55 PM   #7 (permalink)
The Wanderer
 
Join Date: Aug 2009
Location: Pretoria, South Africa
Posts: 11
Thanks: 0
devnull is on a distinguished road
Default

Quote:
Originally Posted by JaoudeStudios View Post
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?
__________________
~ Work is love made visible ~

Flexible Programming Tips & Tricks
Send a message via Skype™ to devnull
devnull is offline  
Reply With Quote
Old 08-11-2009, 01:57 PM   #8 (permalink)
Wizard
Top Contributor 
 
Village Idiot's Avatar
 
Join Date: Sep 2007
Posts: 1,299
Thanks: 17
Village Idiot is on a distinguished road
Default

You can learn how to use jquery without knowing DOM, but you will not understand what is happening until you know how jquery works.
__________________

Village Idiot is offline  
Reply With Quote
Old 08-11-2009, 04:05 PM   #9 (permalink)
The Addict
 
Join Date: May 2009
Posts: 287
Thanks: 5
adamdecaf is on a distinguished road
Default

Quote:
Originally Posted by Village Idiot View Post
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.
__________________
My Site
adamdecaf is offline  
Reply With Quote
Old 08-11-2009, 04:16 PM   #10 (permalink)
The Wanderer
 
Join Date: Aug 2009
Location: Pretoria, South Africa
Posts: 11
Thanks: 0
devnull is on a distinguished road
Default

Quote:
Originally Posted by adamdecaf View Post
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?
__________________
~ Work is love made visible ~

Flexible Programming Tips & Tricks

Last edited by devnull : 08-11-2009 at 04:44 PM.
Send a message via Skype™ to devnull
devnull is offline  
Reply With Quote
Old 08-11-2009, 04:19 PM   #11 (permalink)
The Addict
 
Enfernikus's Avatar
 
Join Date: Jun 2008
Posts: 335
Thanks: 2
Enfernikus is on a distinguished road
Default

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');
__________________
My Blog
Enfernikus is offline  
Reply With Quote
Old 08-11-2009, 04:20 PM   #12 (permalink)
The Addict
 
Enfernikus's Avatar
 
Join Date: Jun 2008
Posts: 335
Thanks: 2
Enfernikus is on a distinguished road
Default

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.
__________________
My Blog
Enfernikus is offline  
Reply With Quote
Old 08-11-2009, 04:30 PM   #13 (permalink)
The Addict
 
Join Date: May 2009
Posts: 287
Thanks: 5
adamdecaf is on a distinguished road
Default

Yep, I've actually found JS very simple compared to JQuery.
__________________
My Site
adamdecaf is offline  
Reply With Quote
Old 08-11-2009, 04:37 PM   #14 (permalink)
The Wanderer
 
Join Date: Aug 2009
Location: Pretoria, South Africa
Posts: 11
Thanks: 0
devnull is on a distinguished road
Default

Quote:
Originally Posted by Enfernikus View Post
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
__________________
~ Work is love made visible ~

Flexible Programming Tips & Tricks
Send a message via Skype™ to devnull
devnull is offline  
Reply With Quote
Old 08-12-2009, 12:24 AM   #15 (permalink)
The Addict
 
Join Date: May 2009
Posts: 287
Thanks: 5
adamdecaf is on a distinguished road
Default

Quote:
Originally Posted by devnull View Post
More than often :/

Just for interest sake anybody want to benchmark that? Still at work will do when I get home
Something like this? http://selectors.turnwheel.com/
Also, run the test for yourself. http://selectors.turnwheel.com/slickspeed.php
__________________
My Site
adamdecaf is offline  
Reply With Quote
Old 08-12-2009, 10:19 AM   #16 (permalink)
Moderateur
RegEx Guru PHP Guru Top Contributor Advanced Programmer 
 
Salathe's Avatar
 
Join Date: Apr 2007
Posts: 1,393
Thanks: 5
Salathe is on a distinguished road
Default

Quote:
Originally Posted by Enfernikus View Post
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.
Salathe is offline  
Reply With Quote
Old 08-12-2009, 10:25 AM   #17 (permalink)
The Acquainted
 
JaoudeStudios's Avatar
 
Join Date: Jul 2009
Location: Surrey
Posts: 105
Thanks: 1
JaoudeStudios is on a distinguished road
Default

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.
__________________
JaoudeStudios.com | JaoudeStudios.com Forum | JaoudeStudios.com Blog
OpenSource is the road ahead...!
JaoudeStudios is offline  
Reply With Quote
Old 08-12-2009, 11:19 AM   #18 (permalink)
The Addict
 
Enfernikus's Avatar
 
Join Date: Jun 2008
Posts: 335
Thanks: 2
Enfernikus is on a distinguished road
Default

Quote:
Originally Posted by Salathe View Post
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 )
__________________
My Blog
Enfernikus is offline  
Reply With Quote
Old 08-12-2009, 01:37 PM   #19 (permalink)
The Prestige
Advanced Programmer Top Contributor Good Samaritan 
 
sketchMedia's Avatar
 
Join Date: Oct 2007
Location: Manchester, UK
Posts: 854
Thanks: 32
sketchMedia is on a distinguished road
Default

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)
sketchMedia is offline  
Reply With Quote
Old 08-12-2009, 03:10 PM   #20 (permalink)
The Acquainted
 
JaoudeStudios's Avatar
 
Join Date: Jul 2009
Location: Surrey
Posts: 105
Thanks: 1
JaoudeStudios is on a distinguished road
Default

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 :) )
__________________
JaoudeStudios.com | JaoudeStudios.com Forum | JaoudeStudios.com Blog
OpenSource is the road ahead...!
JaoudeStudios is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with jQuery Hightower Javascript, AJAX, E4X 8 06-23-2009 08:16 PM
jQuery Timer Plugin ETbyrne The Lounge 0 06-14-2009 02:16 PM
jquery wont work for me :( sarmenhb Javascript, AJAX, E4X 2 09-27-2008 08:52 PM
Cookie issue -jQuery Sam Granger Javascript, AJAX, E4X 0 12-14-2007 01:44 PM


All times are GMT. The time now is 05:33 AM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design