Slashdot Mirror


Learning jQuery

hal10001 writes "One complaint of just about any book that attempts to teach a new language or technology is a presumed level of expertise by the authors. I found it refreshing that in Learning jQuery the book begins... well, at the beginning, and increases in difficulty along with the concepts. It gives designers and entry-level interface developers the opportunity to come up to speed at an acceptable pace."Read below for the rest of Brian's thoughts on the book. Learning jQuery author Jonathan Chaffer, Karl Swedberg pages 352 publisher Packt Publishing rating 8/10 reviewer Brian Reindel ISBN 978-1-847192-50-9 summary Better Interaction Design and Web Development with Simple JavaScript Techniques While I consider the screenshots to be lacking in quality, overall, this book will definitely leave you satisfied. The essentials required to be successful at developing with jQuery are all touched upon, and the depth of explanation for each piece of code is precise and clear. You will not find yourself flipping through chapters of fluff, added only to beef up the number of pages. Each tutorial and example is carefully planned and executed.

Describing concepts in relation to any JavaScript library can be difficult. Since libraries are in fact JavaScript, it can be easy to confuse beginners. The authors are careful not to allow this to happen. This is especially apparent in Chapter 3, when highlighting the event model, event capturing and event bubbling. A clear distinction is made between browser implementations and the unique facets of jQuery. Official documentation is often wanting in these areas, and the book fills in the gaps nicely.

Throughout Learning jQuery, additional notation is included to subtly remind developers of any potential gotchas, which is a nice feature. For instance, while referencing the clone() method, it was noted that only elements of the DOM are copied, and not the events previously associated with those elements. These tips are always appreciated, since in a development environment they can prevent hours of head-scratching, and help eliminate frustration.

I was also impressed that the authors cover both JSON and XML as data-interchange formats in Chapter 6, AJAX-How to Make Your Site Buzzword-Compliant. This illustrates conformity not to a single standard, but to real-world development scenarios, where you might encounter both formats. My only complaint here is that not enough time was spent specifically on jQuery's $.ajax() method for AJAX implementations, since in my experience this tends to be more popular than the $.get() method.

The only change I would make to the format of the book would be to divide it into two parts. It is obvious that the authors intended to begin with jQuery key concepts, and then move into cookbook mode. This does happen after Chapter 6, but it would have been helpful to make that distinction more evident. If you do buy the book, be aware that in order to digest these great tutorials, that you should dedicate more time for the latter half of the book.

Finally, I would like to add that although this book does not cover jQuery v.1.2, or the UI plugin, it is still worth the purchase. If you use the latest version of jQuery, and still want to implement the same XPath selectors covered in the book, you just need to download a plugin. You will not find a better resource online for getting into the guts of the jQuery JavaScript library than you will offline reading the book Learning jQuery.

You can purchase Learning jQuery from amazon.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.

85 comments

  1. what is jquery? by stoolpigeon · · Score: 4, Informative

    somebody is gonna ask.
     
      jquery This seems like a good place to start.

    --
    It's hard to believe that's how Micronians are made. Why don't we see it right now by having you both kiss one another?
    1. Re:what is jquery? by vondo · · Score: 1

      Knowing the answer to that is a "presumed level of expertise by the author" I guess.

    2. Re:what is jquery? by Anonymous Coward · · Score: 1, Insightful

      Otherwise known as Yet Another Language that no one really needs/wants/or understands, but will command big bucks on the job boards.

      Of course that will be for people with 5+ years experience in it.

    3. Re:what is jquery? by z0ph4r · · Score: 1

      I've used dojo, jQuery, mochi, mootools, prototype, and rico javascript libraries and I wouldn't bother with jQuery. My personal favorite is mootools, a better javascript framework. Mootools is simply faster, smaller, and more modular (read: well written) than the competition.

    4. Re:what is jquery? by Goyuix · · Score: 4, Insightful

      Perhaps I am just feeding the troll, or perhaps I am just sharing my perspective... but having used many of the same libraries you have we somehow diverged at some point. And that is probably a good thing as I doubt we are really working with the same audience. I really have little to do with design and interaction, I really tend to focus much more on architecture/transport/etc.... the actual "business" logic.

      My evolution went from using prototype to investigating scriptaculous, mootools and YUI - none of which lasted very long as quite frankly they *seemed* more like toys to animate elements on the page rather than providing a clean and transparent way of sending/retrieving data and altering the data on the page. They were quite good at what they did (or their demos showed) but never really seemed to address what I was trying to accomplish. YUI was also VERY cool, but also very bloated feeling and cumbersome to actually use. Put simply, I am much more interested in things like JSON, REST and POX than the various libraries to help transition between those "transports" and display on the page.

      A while back, maybe a year or possibly a bit more, I was introduced to jQuery by another developer and based on his recommendation decided to check it out. I wasn't quite ready to switch over from prototype (which seemed to more closely resemble the custom JS I would write) and adopt a new kind of similar yet strange syntax from a library I didn't quite have an appreciation of. After adopting it for one project to force myself to learn and use it, I have since whole heartedly switched over from prototype and now love and endorse jQuery as the default AJAX library (I hate to call it that, since it really does so much more). Quite honestly I think each of the "major" libraries out there has many benefits, and I am sure you can cite a great variety of reasons why product x is better than product y so check out what is there and see which one is really going to help you the most. If I was doing complex UI manipulation stuff, I would probably look at scriptaculous or mootools again, although the preview for jQuery UI looks promising as well.

      *Disclaimer/Note: this is just my personal experience with them and should not reflect anything on the actual product. I fully recommend checking out the various options to see what works best for you.

    5. Re:what is jquery? by Bogtha · · Score: 2, Informative

      Mootools is simply faster, smaller, and more modular (read: well written) than the competition.

      Faster, smaller and more modular? Firstly, if you are worrying about the speed at which your JavaScript executes, you are almost certainly either prematurely optimising or using way too much JavaScript. Only a minority of developers need to worry about that, even assuming older clients. Having said that, the release notes for jQuery 1.1.3 have some interesting notes regarding the benchmark you refer to:

      • We're over 800% faster than we were in jQuery 1.1.2.
      • We're the fastest framework in the most popular browser, Internet Explorer 6.
      • We're the only framework that doesn't give incorrect results.

      As for smaller, well jQuery is 26kb after packing, and the link you provide says that mootools is 34kb after packing, so I don't see how your link backs you up there.

      As for more modular and well written, in what sense do you mean this? I skimmed over the website, and was struck at how mootools' site itself abuses JavaScript (major annoyance: don't use <div> s and JavaScript to badly emulate links when a real <a> element would do). I find it hard to believe that a project that makes basic mistakes like that would be well written, but if you would care to go into detail perhaps I might change my mind.

      --
      Bogtha Bogtha Bogtha
    6. Re:what is jquery? by Bogtha · · Score: 1, Informative

      No, it's not Yet Another Language. It's a JavaScript library, and it's quite easy to have 5+ years experience with JavaScript.

      --
      Bogtha Bogtha Bogtha
    7. Re:what is jquery? by ZlatanZ++ · · Score: 0

      I'd never heard of it, but I don't see how you need a 300+ page book to learn it!

    8. Re:what is jquery? by foniksonik · · Score: 1

      Check out the Ext library if you ARE looking for user interface PLUS data constructs. It has a JQuery adapter that let's them work in tandem and I've had lots of luck integrating the two in mixed code, cross-browser clean.

      I'm not too impressed with JQuery UI Interface library OTOH. seems bloated and buggy last time I tried it out.

      --
      A fool throws a stone into a well and a thousand sages can not remove it.
    9. Re:what is jquery? by mysqlrocks · · Score: 1

      Otherwise known as Yet Another Language that no one really needs/wants/or understands...

      Are you saying that no one needs/wants/understands JavaScript or jQuery? If you want to use JavaScript for your web applications jQuery is an awesome way to do it. It's simple to understand and really helps you approach JavaScript in a whole new, non-invasive, way. The fact that it uses CSS selectors is great because it really encourages you to use a good design that separates structure, presentation, and behavior. This model provides many advantages including graceful degradation, accessibility, and cross-browser compatibility.

    10. Re:what is jquery? by mysqlrocks · · Score: 1

      Disclaimer: the following is based on very limited experience with MooTools.

      Mootools refuses to namespace their library and redefines the 'Element'. This can (and will) lead to conflicts with other JavaScript libraries. jQuery is fully namespaced and provides a "noConflict" mode so that you can be sure it will play well with others. I would consider that "more modular".

    11. Re:what is jquery? by Anonymous Coward · · Score: 0

      it's quite easy to have 5+ years experience with JavaScript.
      It's also pointless as JavaScript does not take 5+ years to master.
    12. Re:what is jquery? by shokk · · Score: 1

      And yet so many of the people that claim to know it are friggin retards that should not have been hired in the first place.

      --
      "Beware of he who would deny you access to information, for in his heart, he dreams himself your master."
  2. Competition on the way by Anonymous Coward · · Score: 1, Informative

    At the moment this is the only introduction to jQuery, but in a couple of months Manning will release jQuery in Action . It is a pity that the writer of this review didn't wait until both were available to tell which is the better.

    1. Re:Competition on the way by Anonymous Coward · · Score: 0

      It is a pity that the writer of this review didn't wait until both were available to tell which is the better.

      Let me guess: you're one of the authors of the new book :) There's nothing stopping him from writing another review "in a couple of months" (which is more like Feb 08) on this book. And really does the release of another book mean you shouldn't review an existing one?

    2. Re:Competition on the way by KarmasAgent · · Score: 1

      The book is actually available for purchase and pre-release download. Its at this point about 90% complete. I am loving jQuery and am new to it. Saw this (http://www.manning.com/bibeault/) on the jQuery blog (http://jquery.com/blog/) last night and went ahead and purchased it. I've made it throught he first couple (pre-publication, mind you) chapters and am impressed. The book is scheduled for release in December but it worth getting into now. It seems the pre-release PDF you get has markup for the printers/style guys but everything I tried in chapters 1 & 2 worked and the examples were well thought out, informative, and actually use examples close to real-world needs (a complaint I have about the jQuery docs - no context to the examples and the examples are too simplistic).

      My two cents.

    3. Re:Competition on the way by Anonymous Coward · · Score: 0

      No, it's good the writer called this book to our attention. This book has been featured on the jquery website for at least a month, and I'm glad someone reviewed it. Maybe you can review the other one when it comes out, yeah? That'll make you happy, I bet!!!

  3. Bravo by cromar · · Score: 3, Insightful

    While I don't plan to use jQuery, I must commend you on a very well written review. It provides your opinion of the book, without bogging the reader down in chapter-by-chapter recounts of the material.

    1. Re:Bravo by hal10001 · · Score: 1

      Thanks cromar!

  4. Well? Well? by MeditationSensation · · Score: 2, Insightful

    Oh, man, I'm really getting annoyed at that "...well, blah" phrase people use. Next time someone, well, says it, I'm going to, well, sticking a fork in my, well, eye!

    1. Re:Well? Well? by morgan_greywolf · · Score: 1

      Do you know what I have so say about jQuery? It helps make your site buzzword-compliant with AJAX and all that ... well, blah!

    2. Re:Well? Well? by sjaguar · · Score: 1

      Well don't let me stop you. :)

      --
      If at first you don't succeed, call it version 1.0.
    3. Re:Well? Well? by Anonymous Coward · · Score: 0

      Oh, man, I'm really getting annoyed at that "...well, blah" phrase people use. Next time someone, well, says it, I'm going to, well, sticking a fork in my, well, eye!

      From your comment I was going to assume the submitter tossed "well" around like the verbal "umm...". A quick Firefox search highlight shows that the word was used once in this summary, and that was for dramatical effect. Overreact much?

    4. Re:Well? Well? by MeditationSensation · · Score: 1

      Umm... you're confused.

  5. Poor Choice of Name by Anonymous Coward · · Score: 1, Insightful

    Why did they name a Javascript library with the same prefix used by numerous amounts of Java libraries?

    It would be like creating UltraLib.NET... exclusively for the Java platform.

    1. Re:Poor Choice of Name by linuxbz · · Score: 1, Informative

      And why, exactly, should Java own every library that begins with the letter "j" ? Is Java the only programming language that starts with "J" ? Well, no, there's ... well ... JavaScript. Now, you could easily argue that JavaScript is a poor name since it has little or nothing to do with Java, but if you say everything that starts with "x" must relate to X-windowing, everything starting with "g" must relate to Gnome, k* must be KDE, w* must be Windows, etc., it seems that we'll run out of meaningful library names before long.

    2. Re:Poor Choice of Name by Anonymous Coward · · Score: 1, Interesting

      I see. So you must be an anticategorism anarchist I take it?

    3. Re:Poor Choice of Name by Anonymous Coward · · Score: 1, Insightful

      They shoudl have prefixed it with "js", because its pretty well understood that js means javascript. I wouldn't create a library for Visual Basic and call it vQuery, that would be stupid. I don't think its out of line to think that most people would assume jQuery is for Java. I did.

    4. Re:Poor Choice of Name by Anonymous Coward · · Score: 0

      because of the functionality of querying a set of DOM objects and then manipulating them.

    5. Re:Poor Choice of Name by tehcyder · · Score: 1

      I wouldn't create a library for Visual Basic
      Just stop right there.
      --
      To have a right to do a thing is not at all the same as to be right in doing it
    6. Re:Poor Choice of Name by nostriluu · · Score: 1

      Or e.. for ECMAScript. eQuery.

      es? esQuery. It's a bit Spanish though.

  6. oldie but a goodie by tehwebguy · · Score: 4, Informative

    This site doesn't seem to be updated in a few versions, but it's still very applicable:
    http://www.visualjquery.com/

    --
    -- lol pwned
  7. Expertise assumed by authors? by stephend · · Score: 2, Interesting

    "One complaint of just about any book that attempts to teach a new language or technology is a presumed level of expertise by the authors."

    Actually I have the exact opposite experience: whenever I try to buy a book for a new language (or whatever) they always assume that I'm starting right from the beginning, to the point of explaining what an "if" statement and a "for" loop are for. I'm sorry, but if I'm learning C++ or Perl it's pretty unlikely that it's going to be my first computer language.

    I know it's difficult to get the level right but not every book has to be 1000 pages long with full colour screen-shots...

    1. Re:Expertise assumed by authors? by geekoid · · Score: 1

      ", but if I'm learning C++ or Perl it's pretty unlikely that it's going to be my first computer language.
      "

      Generally aspeaking, that's not true at all.

      My wish is that id the use the worded "Advanced" on the cover, then they would for go all the basic 'if' and 'for' statements.

      --
      The Kruger Dunning explains most post on /. http://en.wikipedia.org/wiki/Dunning%E2%80%93Kruger_effect
    2. Re:Expertise assumed by authors? by jeffstar · · Score: 2, Funny

      Perl was my first language! no wonder nobody will hire me now.

    3. Re:Expertise assumed by authors? by walkie · · Score: 1

      I agree 100%. If you're going to explain conditional execution to me, please be kind enough to name your book "An introduction to programming in..." or something similar. Otherwise, just show me what a conditional statement looks like, point out anything that may be unique about it compared to other languages, and move on to more interesting features. Shouldn't take more than a small paragraph, and hopefully less.

    4. Re:Expertise assumed by authors? by Eivind · · Score: 1

      Yeah. All with you there.

      It was my chief complaint with this jQuery-book (we have it at work).

      The actual nuts-and-bolts of jquery are explained clearly and nicely.

      Not many people are reading a book on an advanced, abstracted javascript-library, yet unaware that, for example, HTML has tags, tags are wrapped in less-than and greater-than signs, many tags have an opening and a corresponding end-tag, HTML is often transported over http and any number of other basic concepts that the book saw fit to explain.

      Indeed, if you didn't know these things already, this book would without shadow of a doubt be the wrong one for you. So I don't see the point of explaining it at all.

    5. Re:Expertise assumed by authors? by Anonymous Coward · · Score: 0

      Java is my first language, as opposed to everyone else at my school, who all started off easy with Visual Basic.

  8. Can jQuery replicate Slashdot functionality? by Anonymous Coward · · Score: 0

    the new widget that we all see on /. where by 'dragging' comments are controlled ..can that be implemented with jQuery?

  9. AJAX Frameworks by dannydawg5 · · Score: 5, Informative

    As a web developer, I get asked quite a bit about AJAX frameworks/code libraries. I have nothing but praise for jQuery. Here's my take on some of the major players:

    1. YUI has been object-oriented to the point of uselessness. Everything requires YAHOO.blah.blah.blah(YAHOO.EventUtil.blah.blah.blah), and then they want you to have another line with YAHOO.AddListener.blah.blah(yourFunction) to add it to the execution list. I like objects. Wait, let me clarify, I like MY objects! I stopped doing what they asked and starting writing wrapper functions to their functions.

    2. GWT requires a zillion steps. I spent half a day installing a Java IDE and compiler and running example projects to see how to use it. Perhaps this is useful for massive projects like Gmail, but for the rest of us who are just looking to add a few effects, instead of writing Java to generate JavaScript, you are better off just writing the JavaScript directly.

    3. The Scriptaculous documentation seemed nonexistent. I was trying to find meaty documentation, and every page was essentially "LOOK WHAT I CAN DO!1!11"

    In short:

    1. YUI has a zillion files and still leaves you writing tedious DOM and your HTML ugly. They DO have some good stuff, which I will get to later.

    2. GWT is like installing MS Word when you all needed was a good text editor.

    3. Scriptaculous will leave you hanging.

    (Side Note: I was just learning DOM when I tried out Scriptaculous. The bad taste may be the learning curve all beginner's must go through).

    My recommendation:

    -Go with jQuery + YUI's "reset-fonts-grids.css" file.

    That YUI css file will reset all the browser defaults to an even layout saving you tons cross-browser tweaking. (Some things I disagree with though, like no bullets or numbers on your UL and OL tags. Still worth it though.) YUI Grids also has some nice templates to help you with div-based layouts. They have a few added extras too beyond just JavaScript code libraries.

    jQuery is simply the most elegant and concise JavaScript library I've found. The idea behind it, "find this, and then do that", is great. The code looks simple, and your HTML code is left clean! People have developed modules for it too, so I may can replace my YUI added extras and just worry about 1 code library.

    Hope that helps someone,
    Dan

    1. Re:AJAX Frameworks by j_d · · Score: 1, Informative

      scriptaculous' documentation is a goddamn joke, which is particularly embarrassing since its parent lib, Prototype, has a pretty well-organized and straightforward site.

    2. Re:AJAX Frameworks by vurg · · Score: 1

      How does JQuery compare with Prototype? I'm trying to decide on which one to use.

    3. Re:AJAX Frameworks by dannydawg5 · · Score: 1

      The Scriptaculous code libraries were built upon Prototype. If you download Scriptaculous, you will be required to get Prototype.

      -Dan

    4. Re:AJAX Frameworks by hal10001 · · Score: 3, Informative

      Hi vurg, You will find that Prototype is a bit more verbose than jQuery, and that DOM manipulation is more complicated. However, if you're just using it for effects, then I suggest you take a good look at both, since Scriptaculous (built on top of Prototype) is very well received, while jQuery's UI plug-in is fairly new.

    5. Re:AJAX Frameworks by Anonymous Coward · · Score: 0

      I almost agree entirely with you, except for this:

      -Go with jQuery + YUI's "reset-fonts-grids.css" file.

      Fuck no! Yahoo have this boneheaded notion that you should specify a body font size of 13px, for some idiotic reason like it makes percentages even out in Internet Explorer or something. In the name of all that is holy leave my fucking font size alone!

    6. Re:AJAX Frameworks by onedotzero · · Score: 1

      That YUI css file will reset all the browser defaults to an even layout saving you tons cross-browser tweaking. (Some things I disagree with though, like no bullets or numbers on your UL and OL tags. Still worth it though.) Font sizing? I appreciate that I haven't looked into the YUI css. However, one of my favourite pieces of CSS is:
      body{
      font:62.5%/140% Verdana, Arial, Helvetica, sans-serif;
      }


      This is kind of a 'magic calculation' - setting the font size to 10px on every relatively modern browser. From then on in, percentages can be used to increase sizing uniformly.

      My other two standard defaults are:

      1. Setting everything (*) to margin:0 and padding:0 and lists to have no list-style-type. I personally prefer this - I use lists a lot more for structure (menus, breadcrumbs and such) than for traditional word processing-style formatting. So on a standard content div I'll put the list style back.

      2. Removing the dotted-line focus on A tags.

      I wonder what else is in that css to make it worthwhile to bother bringing in a 3rd party script... I'll have to check it out.
    7. Re:AJAX Frameworks by Anonymous Coward · · Score: 0

      Here's my take on some of the major players: [suck, suck, suck]

      Note to self: it appears that picking a minor player was a great idea! *pats self on back*

      Note to others: I'm not going to name it because that would just invite a flamefest here. The lesson is not to pick a particular library, but that as long as you're delivering HTML+CSS+JS to the client, it doesn't matter if your library is a "major player" or not.

      GWT requires a zillion steps. [...] Perhaps this is useful for massive projects like Gmail, but for the rest of us who are just looking to add a few effects, instead of writing Java to generate JavaScript, you are better off just writing the JavaScript directly.

      Google's GWT page is intentionally misleading here: none of their internal major projects (like GMail or GMaps) actually uses GWT. They bought a startup, changed the name to GWT, and open-sourced it. GMail predates GWT (under any name).

      There's a lesson here, too: if you've got a great system in place already, it doesn't matter what new library comes along. If it doesn't make your life easier, don't use it. GWT is so good ... none of the Google projects is switching to it. And why should they? You can be awesome without a big-name library, and you can suck even if you're buzzword-compliant.

    8. Re:AJAX Frameworks by Anonymous Coward · · Score: 0

      setting the font size to 10px on every relatively modern browser.

      ...if the user hasn't changed the font size. I find the default font size too large for my liking, so I reduced it in my browser settings. Now your website layout is totally screwed up because you thought you could depend on 1em being equal to 10px.

      Please just stop using this trick. It's a really shitty hack, and it's not even particularly useful. You didn't know the font size before, you don't know the font size now.

      From then on in, percentages can be used to increase sizing uniformly.

      Percentages aren't supposed to increase sizing uniformly. That's why they are percentages and not absolute units!

      2. Removing the dotted-line focus on A tags.

      So people who use the keyboard to navigate are totally unable to see where they are tabbing to? Why would you want to disable this?

    9. Re:AJAX Frameworks by _bluevincent_ · · Score: 1

      I think special mention should be given to Ext JS library
      It provides clean fully implemented widgets and it also supports integration with jquery and other libraries.
      I have not found I library that competes with Ext JS and continues being Open Source Just Check it out extjs.com

    10. Re:AJAX Frameworks by onedotzero · · Score: 1

      I find the default font size too large for my liking, so I reduced it in my browser settings. Now your website layout is totally screwed up because you thought you could depend on 1em being equal to 10px. Test it yourself. Set (browser default) font sizes to 10px, 20px or 30px and load a test site - the font sizes are the same (i.e. the 10px that CSS sets it to) across all browsers. And yes, using EM measurements for anything other than text measurements (line-height etc) would be a little silly.

      Percentages aren't supposed to increase sizing uniformly. That's why they are percentages and not absolute units! If I know that a font-size of 100% is 10px on all browsers, then 110% is 11px, 120% is 12px - used for headings etc.

      So people who use the keyboard to navigate are totally unable to see where they are tabbing to? No, you give a:focus the same styling as a:hover (underline, colour change) so it's still clear which A is selected via keyboard navigation.
    11. Re:AJAX Frameworks by Anonymous Coward · · Score: 0

      Set (browser default) font sizes to 10px, 20px or 30px and load a test site - the font sizes are the same

      That's a really bad thing.

      And yes, using EM measurements for anything other than text measurements (line-height etc) would be a little silly.

      No, if you don't fuck up the font size, then it's actually quite sensible. For instance, the whitespace surrounding text, e.g. margins and padding, looks silly if it's out of proportion to the text.

      If I know that a font-size of 100% is 10px on all browsers, then 110% is 11px, 120% is 12px - used for headings etc.

      You still don't get it. Look, if you set a heading to 120%, that should mean that headings are slightly larger. But 12px is tiny compared with my normal text size. Percentages are a relative unit, they are supposed to take an existing font size and modify it slightly. You are using a dumb hack to convert them to absolute units. Why bother with percentages in the first place? It's not more "accessible" if you bodge it to be a specific pixel size.

  10. jI jAm jGetting jSick jOf jThese jNames by Anonymous Coward · · Score: 0
    jWhat's jNext, kOffice?

  11. lost in DOM caves by Tablizer · · Score: 1

    Maybe I'm just a diehard relational weenie (AKA "Tablizer"), but I feel that DOM should be tossed and replaced with a relational equivalent1[1]. Non-trivial DOM has many the drawbacks and speghetti messiness of "navigational databases" of the 60's that prompted Dr. Codd to formulate relational.

    At least lets give the idea a good hard thinkover.

    [1] Perhaps using a "dynamic" version of relational that has optional types and optional column size limits, and maybe something more powerful/flexible than SQL as a relational query language.

    1. Re:lost in DOM caves by dugless · · Score: 1

      "His pattern indicates two-dimensional thinking." -Spock

    2. Re:lost in DOM caves by Maskull · · Score: 1

      The official DOM API was never intended to be the interface to the DOM, merely a kind of portable backend. It was assumed that more appropriate, language-specific bindings would be built on top of this.

    3. Re:lost in DOM caves by nuzak · · Score: 1

      Yes, you are a diehard relational weenie. Codd would not approve of his theories being promoted as a Magical Golden Hammer to represent all data.

      Documents are hierarchical by their nature. DOM has lousy syntax, but that doesn't make it the wrong data structure.

      --
      Done with slashdot, done with nerds, getting a life.
    4. Re:lost in DOM caves by Anonymous Coward · · Score: 2, Interesting

      I am trying to think of a worse idea than this, but failing.

      It makes more no sense to shoehorn relational concepts into something -- a Document -- that is inherently non-relational than it does to shoehorn hierarchical concepts into something inherently relational.

      I am more than willing to be proven wrong, however; if you think it is a good idea, you could pretty easily build a jQuery plugin to provide SQL-like access to elements in a document. It would be a good test bed for your ideas that would require no more than a browser for others to try it. Release it into the wild, and, if the idea truly has merit, people (including me) will embrace it. If not, or it is too diffuclt for you to implment, than perhaps the idea is not all that you think it is.

    5. Re:lost in DOM caves by Bogtha · · Score: 1

      Do you have a reference for this? As I understand it, the specification was written in a generic way precisely so different languages could implement the exact same interface. If you are referring to this text from the DOM 1 specification:

      Vendors can support the DOM as an interface to their proprietary data structures and APIs, and content authors can write to the standard DOM interfaces rather than product-specific APIs, thus increasing interoperability on the Web.

      ...and this:

      The DOM specifies interfaces which may be used to manage XML or HTML documents. It is important to realize that these interfaces are an abstraction - much like "abstract base classes" in C++, they are a means of specifying a way to access and manipulate an application's internal representation of a document. Interfaces do not imply a particular concrete implementation. Each DOM application is free to maintain documents in any convenient representation, as long as the interfaces shown in this specification are supported.

      ...then what this means is that it shouldn't matter how Microsoft or Mozilla decide to implement their rendering engines, web developers should be able to write to a single, portable interface without worrying about how any one browser implements things. If you look further, it certainly seems like the W3C were aiming for a canonical interface:

      As a W3C specification, one important objective for the Document Object Model is to provide a standard programming interface that can be used in a wide variety of environments and applications. The DOM is designed to be used with any programming language.

      --
      Bogtha Bogtha Bogtha
    6. Re:lost in DOM caves by Tablizer · · Score: 1

      Documents are hierarchical by their nature.

      I disagree. They can be made hierarchical, but I see nothing that says they must be. Besides, relational is perfectly capable of representing hierarchical structures if need be. It ideally "sees" hierarchies as ONE OF MANY possible views of given information, which is how it should be. There is no One Right View that is ideal for everything. Something "has-a" parent, not necessarily "is-a" parent.

    7. Re:lost in DOM caves by Tablizer · · Score: 1

      It makes more no sense to shoehorn relational concepts into something -- a Document -- that is inherently non-relational than it does to shoehorn hierarchical concepts into something inherently relational.

      Please clarify what you mean by "non-relational". How are you measuring "relational-ness"?

    8. Re:lost in DOM caves by Tablizer · · Score: 1

      The distinction between interface, structure, and implementation can get pretty fuzzy at times. Every interface imposes a kind of "flavor" or style in philosophy for how to structure things and how to do things. Another way of saying this is that there are multiple different potential interfaces to perform the same given thing (satisfy result specifications).

    9. Re:lost in DOM caves by Anonymous Coward · · Score: 0

      Please clarify what you mean by "non-relational". How are you measuring "relational-ness"?


      This does not have the rigor of a mathematical approach, but I mean a document consists primarily of elements that have little to no cross-referencing. (Think of paragraphs and chapters.) As such, neither a tabluar structure nor a SQL-like syntax confer any advantages whatsoever. This does not include sets of structured data, which are usually handled server side with a relational back end, but this is not relvant in the context of your original assertion, that the DOM should be replaced with something table-oriented.

      However, I am more than willing to eat my words, and the beauty of open source is that you have the opportunity to do so. If you feel a tabular structure would be better than a DOM, all you need to do is create a document, and some manner of "tabular" structure and method of access. To bring this thread back to the original /. article, you could even make this SQL-ish wrapper a jQuery plugin. The proof is the pudding; if you can create some concrete use case where a table structure is superior for the DOM for the things we currently use DOM scripting, developers would be happy to embrace it.
    10. Re:lost in DOM caves by Maxmin · · Score: 1

      JQuery and related functions (document.getElementByTagName() etc.) are built around the need for a relational view of the hierarchical DOM document. They let you choose "rows" of DOM objects, based on criteria such as className, tagName, and DOM ID.

      Realize first that the DOM is essentially a tree structure, with pockets of collections or arrays of same/similar objects. You can indeed treat it like a relational database, but keep in mind that just about all objects are children, and many are parents.

      Those relational interfaces are handy for retrieving (reading) the DOM, but the write to it, you have to use DOM methods, pretty much.

      Not sure how else you'd do it - got any ideas?

      --
      O lord, bless this thy holy hand grenade, that with it thou mayest blow thine enemies to tiny bits, in thy mercy.
    11. Re:lost in DOM caves by Tablizer · · Score: 1

      However, I am more than willing to eat my words, and the beauty of open source is that you have the opportunity to do so. If you feel a tabular structure would be better than a DOM, all you need to do is create a document, and some manner of "tabular" structure and method of access.

      Various versions of FoxPro have actually done this. The GUI screen specifications were stored in tables. However, it was not very well designed IMO, and was based on coordinate screens (a good GUI engine would allow both coordinates and nested), but it did work for the most part. But the current lite-duty RDBMS are not dynamic enough IMO, so I'd have to work on that part first.

      but I mean a document consists primarily of elements that have little to no cross-referencing.

      I'm not sure this is a requirement to be "relational-friendly". (BTW, "relational" actually means "table-based" more or less, NOT "links", contrary to popular belief.)

      But think of some of the advantages. For example, suppose you want to control the tab order (sequence when pressing Tab key) of a bunch of widgets. After putting the ordering into the GUI structure, what would be easier, to place and query such an order in relational, or with OOP-style navigational structures?

      Or if you need to change only the font of all buttons with a label longer than N characters. It is a lot easier to sort, filter, cross-reference, and group how YOU want to see it any given point in time.

      And dynamic relational can "degenerate" into navigational structures with relative ease if somebody wants to go that route. I agree that 15 years ago it would probably be too resource-bulky to consider such, but relative to other stuff these day, it is small.

    12. Re:lost in DOM caves by Tablizer · · Score: 1

      "His pattern indicates two-dimensional thinking." -Spock

      I am not quite sure what the implication is here. "Table" is only a conceptual presentation view. You can store 3D coordinates, or 11D coordinates if you want. How you display them in actual space depends on the display device and transformation views you use.

    13. Re:lost in DOM caves by smellotron · · Score: 1

      I am not quite sure what the implication is here. "Table" is only a conceptual presentation view. You can store 3D coordinates, or 11D coordinates if you want. How you display them in actual space depends on the display device and transformation views you use.

      You're still looking at it from a two-dimensional point of view. Not the data you store, but your data-storage mechanism. There are two axes in a table:

      1. The set of available columns in a table
      2. The set of available rows in a table

      What if you took one (or both) of those axes away? What if you added more axes? Relational tuple calculus (tables) is generally only 2D. You could consider enumerated values as a third dimension (in the same way that enumerated columns are a second dimension).

      From an algebraic point of view, that's scalar (0D)-> vector (1D) -> matrix (2D) -> tensor (3D) -> ??? -> profit.

      From a mesh-topological view (e.g. 3D geometry), that's point (0D) -> line (1D) -> surface (2D) -> volume (3D) -> ??? -> profit.

    14. Re:lost in DOM caves by smellotron · · Score: 1

      Documents are hierarchical by their nature.

      I believe the World Wide Web and a href beg to differ. Links simply exist to join document fragments together non-hierarchically.

    15. Re:lost in DOM caves by Tablizer · · Score: 1

      2D is chosen largely because most people can relate to it well. If we make 1D the "atomic" dimension, then we have a wimpy structure. If we go with 3D, when we have something that is hard to use on paper and 2D screens. And trees don't handle new orthogonal factors well. Maybe in the future when we have 3D hollographic displays or direct brain pluggins, this may all change. Until then, 2D seems the best way to go. Perhaps it is in part a personal preference, also.

    16. Re:lost in DOM caves by Bogtha · · Score: 1

      With all due respect, that's just a bunch of hand-waving that is so vague it's impossible to extract anything relevant to my comment. Of course there are multiple potential interfaces to perform the same thing. That's always true, obvious to everybody, and isn't relevant to the fact that the DOM defines just one canonical interface.

      --
      Bogtha Bogtha Bogtha
  12. I on the other hand.. by Anonymous Coward · · Score: 0

    Don't encourage the use of any frameworks. People should just learn the DOM and code their own javascript. This kind of crap encourages people to not really learn the language. They see oo pretty Javascript Jquery, but can't methodically code a program if I ask them to. Keep your own functions and objects like in any language for reference, but never use a framework.

    1. Re:I on the other hand.. by Bogtha · · Score: 1

      You're confusing two different things here; JavaScript and the DOM. The DOM isn't part of the JavaScript language, it's merely a series of host objects following an interface defined by the W3C. While you can debate the merits of the two different interfaces all you like, it doesn't mean that using one instead of the other means you don't know JavaScript.

      If somebody can't "methodically code a program", then they are going to have just as much difficulty with jQuery as they are with the DOM. jQuery can't be used as a substitute for programming knowledge. At worst, you could say that people would copy and paste from the jQuery examples, but the same has been true for JavaScript in general for the past decade, so jQuery is no different in this respect.

      --
      Bogtha Bogtha Bogtha
    2. Re:I on the other hand.. by Keeper+Of+Keys · · Score: 1

      This sounds great, and very pure, BUT javascript suffers from some atrocious cross-platform incompatibilities which aren't going away any time soon. jQuery is, as much as anything else, a cross-platform wrapper for javascript, so you don't have to worry about how, say, ajax is implemented on various browsers. This is probably true of the other js libraries people are mentioning here, and a very good reason to use one of them.

      I started using jQuery about 2 years ago because I found it much easier to learn that dojo or prototype. I'm not sure why it's so important to you that people "learn the language" (ie javascript) when presumably you wouldn't expect someone learning C++ to necessarily know assembler. As it happens I think the core ecmaScript language is very beautiful, but there's nothing to stop me including as much or as little of it as I wish in my jQuery code.

      In short, this particular framework is not the straitjacket you seem to think it is.

  13. Very good, and very easy by SirJorgelOfBorgel · · Score: 2, Interesting

    I have used other javascript libraries like Dojo and YUI in the past, but I fell in love with jQuery after a day of playing with it. It's lean and it's mean. I was by no means very good in JavaScript when I started with it (though I did have a lot of experience in other programming languages), but jQuery was really easy to grasp. Then after a few weeks, after reading lots of code for jQuery plugins and the like, I found I knew a hell of a lot of rediculous details and (seemingly) 'quirks' (that are really cool features) about JavaScript. By now I find JavaScript actually a nice language to code in, all because of jQuery! (Seriously, I tried the same with YUI and Dojo and just got a headaches) Best JavaScript framework I have ever used, even if I disagree with JohnResig about what important features all the time ;)

  14. "more modular" == "well written"? Seriously? by weston · · Score: 1

    simply faster, smaller, and more modular (read: well written) than the competition.

    Leaving aside that jQuery has some substantial claims to being fast (fastest in IE6) and small (26k packed, vs MooTools 40+k packed)...

    If the prevailing philosophy amongst the mootools team is in fact "more modular" == "well written" then that explains a good deal. Take a look at the download page:

    http://mootools.net/download

    Notice anything? There's a pretty sweet app that knows which parts of MooTools are dependent on the other parts of MooTools.

    But note there's also no apparent way to download all the code -- something someone unfamiliar with the library might want to do in order to (a) read the code as part of the process of familiarizing themselves and (b) have everything present while you're still developing the familiarity required to *know* exactly what you do and don't need.

    How is it that these people are smart enough to build something as cool as the sweet dependency app but not smart enough to let someone just download everything?

    Well, it turns out there is a way, which they have noted over in the FAQ for the forum:

    http://forum.mootools.net/viewtopic.php?id=1964#post-9398

    Think about this for a moment. This is a *Frequently Asked Question* -- how to download the whole thing, which means it's obviously something people want to do. There's an answer in the FAQ that would have as easy to add, in code, to the download page, as it would have been to post to the FAQ -- possibly easier. So why is there still no "download all" link on the page?

    Because the MooTools team is more interested in having their philosophy of modularity impressed on you than giving you convenient access to the code.

    Not a good sign. I investigated further anyway, but found pretty much what I expected after that: in many places (enough to be annoying) the library values certain somewhat arbitrary conceptions of correctness over ease of invocation for the developer.

    Prototype is peppered with all kinds of "we can't stand programming in anything other than Ruby"isms that are almost as annoying, but when it comes down to it, it's simply easier to use. And jQuery stands up *very* well in that regard.

    I don't begrudge the MooTools developers their choices -- they're the ones doing it, they should write the library that pleases them. And I imagine there are users with the same mindset as the developers who will love it. But MooTools doesn't live up to the broad claims like those the parent poster made here (faster, smaller, "simply" better).

    1. Re:"more modular" == "well written"? Seriously? by Bogtha · · Score: 2, Funny

      Take a look at the download page:

      http://mootools.net/download

      Notice anything?

      Nope. The reason why I don't notice anything is because the contrast between the text and the background is so low that the text is invisible unless I crank up the gamma on my monitor, and even when I do so, the text is unreadable because it's absolutely tiny. They've actually hard-coded a 9px font size in there. Ridiculous.

      What's more, they specify the OS X font Lucida Grande, which has a large x-height, followed by Arial, which has a normal x-height, meaning that if you don't have Lucida Grande installed (e.g. Linux users), the text appears smaller than if you do have Lucida Grande installed (e.g. OS X users). Where do some designers get the idea that this style text is in any way a good idea?

      --
      Bogtha Bogtha Bogtha
  15. Perhaps some way of "querying" the document? by weston · · Score: 2, Informative

    I feel that DOM should be tossed and replaced with a relational equivalent

    You mean some sort of method of accessing it via flexible symbolic queries describing attributes and relationships between nodes? One that retrieved arrays of matching results?

    If only someone had invented such a thing. ;)

    (To be fair, most of the other libraries have something similar as well.)

  16. Why isn't anyone mentioning the ext JavaScript library? jQuery is so last year!

    -- For Shizzle

    --
    Censorship is obscene. Patriotism is bigotry. Faith is a vice. Slashdot 2.0 sucks.
    1. Re:Ext by psyclone · · Score: 1

      ExtJS appears to have interesting license requirements.

      It is released under a commercial license and LGPL 3, but only for certain uses.

  17. Complaint? More like praise by Sentry21 · · Score: 1

    One complaint of just about any book that attempts to teach a new language or technology is a presumed level of expertise by the authors.


    I'm going to dispute this assertion. I'm sick and tired of browsing through programming books at Chapters, picking up a copy of 'Advanced Python: Things that Guido van Rossam Doesn't Know' and having it start with four chapters on 'What is a programming language?' and 'What is a variable?', treating the user like a simpleton for the majority of the book, before spending three footnotes in the appendix mentioning 'highly advanced' topics like writing C modules.

    I want to see MORE of what the reviewer is apparently complaining about. I want to see a Python book that doesn't assume I've never heard of programming before. Who does this? Do people give random programming language books as gifts? My family members are smart enough not to grab a random book off the shelf, but I suppose I can't assume this for everyone.

    If you're teaching me something, teach me that something. If I need to know a technology beforehand, then hey, here's a thought - refer me to another book and tell me to buy that one first. If there isn't one then write two and make twice the money, but don't make me pay $79.99 for a book that spends 2/3 of its time telling me the origins of functional programming.
  18. Books about tech? by JAlexoi · · Score: 1

    Books about a particular technology(product) in my opinion are not worth the paper. When I buy a book I think of it as an obligation to have it for a long time. I could not throw away a book, its just not an option to me. As for technologies, I believe that magazines are the place that these things have to be published. Magazines are the ones that contain CURRENT knowledge, regardless if it will be outdated tomorrow. Books are for timeless knowledge, or at least for knowledge that would span tens of years. jQuery will probably fade away in 5-10 years, because something new will come up.

    But I add an exception for manuals that come with a particular product. Those are books about a particular product.

    This is my personal opinion.

    1. Re:Books about tech? by delinear · · Score: 1

      And imagine in 10 years time you find yourself having to convert a mess of an app from some by-then dead language to whatever the fad language of the day will be. You might just be grateful to be able to get a copy of a book on the subject many years after all the magazines relating to it have been consigned to recylcle bins. Not to mention the historical value of such books to scholars in the future.

  19. JQuery in a nutshell by brunes69 · · Score: 0, Troll

    jQuery is yet another JavaScript/AJAX abstraction library - just one of a hundred such things. It's littered with random obscure bugs between browsers, just like all others. The one thing that sets it apart from the rest is its ugly and arcane syntax and poor performance compared to others.

    Sound good?

  20. What about Dojo? by dostick · · Score: 1

    Huh aren't you missing obvious elephant in the room?

    What about Dojo? The most popular Javascript framework, supported by IBM.

    Basically if you do any kind of serious development you have one of therree choices:

    GWT- which requires that you program in Java and onform to their configuration management model
    YUI - If you are mad and willing to use bloated, slow and badly performing library
    Dojo - none of the above.

  21. Another endorsement for the book by macurmudgeon · · Score: 1

    I know, you don't have to read or pay for a book. There's all the information online. But a well written reference can save a lot of time. Following links and ending up finding content that is poorly written and confusing or that requires reading a previous entry that in turn references yet another entry is not something that I want to waste otherwise billable hours doing.

    Like a lot of other people, I've looked at a number of JavaScript libraries and decided that jQuery was the best fit for my needs. What appeals to me most is that jQuery handles most of the cross browser headaches that JavaScript brings as baggage. So I bought Learning jQuery and have been quite satisfied. jQuery is enough different from plain vanilla JavaScript that I was having a bit of trouble wrapping my head around it. A couple of hours spent working quickly through the first few chapters cleared that up.

    This is a worthwhile addition to my library. The writing is clear and concepts are presented in a logical order, and the examples are actually useful. Anyone with a solid grounding in HTML and CSS who has even a basic understanding of the DOM will quickly be able to write useful scripts that tap into this lean and efficient framework. I've worked my way through most of the book and have a pretty solid intermediate grasp of jQuery and have been able to easily add it to my last couple of projects as progressive enhancement that leaves pages still usable with JavaScript turned off.

    As you would expect from a book with the title, Learning jQuery, it doesn't take you into true expert territory and that's a plus. It's just the right length to provide a solid grounding without being a doorstop that never gets opened. I've bought too many "Bibles" or "Definitive Guides" in the past and never got around to working through them. Start simple and take learning 0ne-step-at-a-time works for me. Having somebody do the hard work of learning the framework, distilling the concepts down and serving them in a concise and logical order makes my learning curve so much shorter that I consider the price to be money well spent.