SitePoint Sponsor

User Tag List

Results 1 to 13 of 13

Hybrid View

  1. #1
    SitePoint Zealot Ken Sharpe's Avatar
    Join Date
    Apr 2008
    Posts
    160
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    People new to Javascript should read this

    Something I'm seeing over and over in this forum is something to the effect of: I'm trying to do X, and it works in [browser1] but it won't work in [browser2], what is wrong?


    I'd just like to say that no modern, application-level javascript is written at the level where browser should make a difference. You should be using one of the many freely available javascript libraries.

    The point of those libraries is to abstract away the nuts and bolts of getting a particular DOM object from a given browser, or changing values around. They do all the work of making your code browser cross compatible.

    I personally use JQuery, which I can't recommend highly enough, but any of the major libraries will server you far better than raw DOM scripting. You will be more productive, and less frustrated, I promise.

    Do it!

  2. #2
    SitePoint Enthusiast Grayson's Avatar
    Join Date
    Jun 2008
    Posts
    76
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I wrote my own however if you are not proficient i would suggest Qooxdoo, it's much lighter than most other frameworks.

  3. #3
    SitePoint Addict
    Join Date
    Dec 2007
    Posts
    207
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I don't really agree.

    People new to javascript should learn javascript and dom methods before using a library, imo.
    mmj

  4. #4
    SitePoint Zealot Ken Sharpe's Avatar
    Join Date
    Apr 2008
    Posts
    160
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Why? Did you learn how logic gates are implemented, before learning assembly, before learning C, before learning... etc?

    This is a solved problem. There are people -- library authors and hardened web professionals-- who need to know the ins and outs of the DOM, but why force a beginner to learn the arbitrary quirks of a language that doesn't have a consistent implementation? What practical purpose can that possibly serve?

  5. #5
    SitePoint Addict
    Join Date
    Dec 2007
    Posts
    207
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Ken Sharpe View Post
    Why? Did you learn how logic gates are implemented, before learning assembly, before learning C, before learning... etc?

    This is a solved problem. There are people -- library authors and hardened web professionals-- who need to know the ins and outs of the DOM, but why force a beginner to learn the arbitrary quirks of a language that doesn't have a consistent implementation? What practical purpose can that possibly serve?
    A beginner shouldn't be writing live code. There WILL be bugs, security holes, etc. Once he is not a beginner then he can write live code.
    mmj

  6. #6
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by M-M-J View Post
    People new to javascript should learn javascript and dom methods before using a library, imo.
    I agree. JavaScript libraries are there to make us more efficient once we know what we're doing, not as an abstraction layer that lets us skip a large part of the learning curve.

    Quote Originally Posted by Ken Sharpe View Post
    Why? Did you learn how logic gates are implemented, before learning assembly, before learning C, before learning... etc?
    Yes, I did.
    Birnam wood is come to Dunsinane

  7. #7
    SitePoint Zealot Ken Sharpe's Avatar
    Join Date
    Apr 2008
    Posts
    160
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    MMJ, here in reality not everyone who writes front end code is a front end architect.

    What I'm saying is that even experts should use these libraries because it saves times and bugs down the road. Pretending like it's normal to reinvent the wheel all the time is wasteful. If you're interested it learning the deep logic of some system, then do it. If you're a consumer of that system, like 99% of people writing javascript, it's not going to help them to know that injecting a table into the DOM requires an explicit tbody in IE to access child cells-- it's just doesn't matter.

  8. #8
    SitePoint Addict
    Join Date
    Dec 2007
    Posts
    207
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Ken Sharpe View Post
    People new to Javascript should read this
    Quote Originally Posted by Ken Sharpe View Post
    You should be using one of the many freely available javascript libraries.
    People new to javascript need to learn javascript, the basic dom methods, and how to do some simple browser stuff before they start using a library.
    mmj

  9. #9
    SitePoint Zealot Ken Sharpe's Avatar
    Join Date
    Apr 2008
    Posts
    160
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You're killing me, man. You've just begged the question -- my point is that one does not, in fact, have to learn the basic dom methods before using a library. That's what we're arguing about. You can't just restate your position and expect the conversation to move forward!

  10. #10
    SitePoint Zealot evilunix's Avatar
    Join Date
    Jun 2008
    Location
    York, UK.
    Posts
    114
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sorry Ken, but I think it's important to learn to walk before you can run...

  11. #11
    Function Curry'er JimmyP's Avatar
    Join Date
    Aug 2007
    Location
    Brighton, UK
    Posts
    2,006
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    A new learner may find a library much easier to grasp... but it's important for them to learn the real language behind the magic!
    James Padolsey
    末末末末末末末末末末末末末末末末末末末
    Awesome JavaScript Zoomer (demo here)
    'Ajaxy' - Ajax integration solution (demo here)

  12. #12
    SitePoint Member
    Join Date
    Sep 2003
    Location
    Pomona
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hopefully I'm not just throwing fuel onto a religious debate, but I think it's important that we try to at least achieve clarity, if not agreement.

    I would say that people who are "new to Javascript" fall into two categories:
    1. They want to accomplish a specific task (validate a form on their website, fade an image, toggle a group of form fields when a user does X).
    2. They want to become a full time front end developer.

    I would say the overwhelming majority would fall into group 1. Most people aren't looking to spend their lives becoming Javascript gurus. And thank God for that. I need people to specialize in those areas where I don't have a passion, and I think it makes us all the richer that not everyone wants to understand the inner magic of that language that we love.

    So if you're here because you're in group 1, just use a library. There's really no point in stressing over cross browser issues, and other problems that people have solved over and over and over again.
    Get your solution, get done, and get moving onto the next thing.

    But, if you're from group 2, you should spend the time learning the internals. Now, sure, use the libraries. They were created not only for the commoners who don't want to learn, but mostly because we all get sick of fixing the same problem.
    But remember that the abstraction you're learning isn't Javascript. You're learning an API for easy access that is really masking the magic.
    So take your time, and if using a library helps you enter in the JS world from a perspective you're more familiar with (jQuery if you're from CSS, Prototype if you're from Ruby, Yahoo or dojo if you're from a language with long hard to remember package names ).

    But I think the overzealous people who are always yelling at others about how and what they SHOULD learn seem to forget that they're using an abstraction layer on top of much more sophisticated concepts than 99.98% of front end developers ever wish to deal with.

    Sure, we're all good programmers in our own right, but frankly, I have no desire to learn the advanced mathematical concepts that power my freedom to use the tools that other people, MUCH smarter than me and with much more interest and passion for such things, have taken the time to build.
    And hopefully, I'll be able to build and contribute something to the world that others, who have no interest in the things I am passionate about, can find useful, and help them solve real problems.

    I have no desire to learn the basic concepts of mechanical engineering, the 4 cycles of a combustion engine, or how the bore and the stroke of the engine factor to determine the cubic displacement of an engine, but that doesn't mean when I want to change my oil that I need to put up with car geeks telling me how I should really be learning all those things.

    I got things to go code so those guys can use things like Google Maps and their Yahoo Mail without ever wondering what powers it.

    And I think the distinction of stated goals is important here.

    Thats all

  13. #13


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •