Well written, robust code that uses appropriate feature detection and
fall back strategies is not difficult to write.


That's why the web is full of that, right? If you write for yourself or an app for your hairdresser, yes. If you write in a company decisions are made by committee, not driven by tech excellence. Get out of your ivory tower and ride your unicorn down the town square and see some of the issues the commoners have to deal with.

Then you don't understand how to implement feature detection. No one
is saying write every application from scratch, or that you shouldn't
use any kind of library. Just don't use poorly written general
libraries.

Some cheese with that whine? All the big libraries are open source and very much in use. If you really are that gifted and care about what people use on the web, file bugs and fix these oh so poorly written libraries. Right now, you come across as someone with a massive ego who is grumpy as people do not use his stuff or ask him to build bespoke code. It is too easy to say something is "poorly written" [citation needed] is what I say.
If you design an application to just use basic, simple javascript then
you don't need complex CSS selectors, chaining and so on. You just
need a library of basic functions that does what you need and no more.
And that can easily be written to be cross-browser with very little
extra effort and maintained in your (or the corporate) repository.

By whom? You expect that the people coming after you are as gifted and dedicated to the cause. Most of the big projects I built went into maintenance mode sooner or later. At least with libraries like YUI or jQuery they didn't mess around with the core code of the library. FYI: I don't like chaining and if you write massive CSS selectors you are doing it wrong.

With your own solutions you will find document.write() hell added by maintainers sooner or later. Wake up and smell the corporate mandate: "release this quick - maybe you get a chance to fix it later". I left my last role as a frontend architect as I've seen over and over again that you will not touch code that was shipped ever again unless you work on internal products. The web gets build by many people - a lot of them incompetent design agencies - if we can use a YUI or jQuery to at least deliver a basic support for all browsers instead of undocumented code magic then we are at least moving ahead.
If not, which DOM traversal-only library do you suggest I use ?
Any javascript programmer who needs a library to do DOM traversal
should not be writing production code. It would take me 10 minutes to
teach a programmer what they need to know to do it.

The DOM is friggin broken and badly supported across browsers. Yes, that comes from the guy who wrote "Beginning JavaScript with DOM Scripting and Ajax" 5 years ago. If you really want to support browsers, then a library that polyfills the browser differences for you makes a lot of sense. Check out John Resig's "The DOM is a mess": http://ejohn.org/blog/the-dom-is-a-mess/

And don't get me started on Events. If you don't simulate them you can never do proper event delegation with keyboard access for example.

Of course you can teach DOM in 10 minutes. The issue is that applying DOM properly needs 3 years of experience on how browsers fail to understand it. And personally I'd rather concentrate on building sensible interfaces for end users rather than patching 10 year old code.

What should I recommend to new employees in my company when they have to
learn Javascript, who have to start coding with Javascript without having
had any proper formation ?
If you are in any kind of supervisory or management position then it
is your responsibility to ensure that the people you are in charge of
are competent to perform the tasks they are set. If they aren't, you
either ensure they get appropriate training or get someone who has
appropriate skills to do the job instead.
Big topic here. I told my last company I leave my job when the first backend developer writes JavaScript as "engineer is engineer" - and I did.

There is no good corporate JS training (oh wait, isn't that why we did this list?). What I normally tell people to do is to train their folk up to understand JavaScript how it is implemented.

Go through the http://www.opera.com/company/education/curriculum/ and check out Crockford on JavaScript: http://yuiblog.com/crockford/

Then use a library SENSIBLY to allow you to concentrate on building things for end users.

Great talk on this: http://lanyrd.com/2011/lwsmix/scckp/


Chris



--
To view archived discussions from the original JSMentors Mailman list: 
http://www.mail-archive.com/jsmentors@jsmentors.com/

To search via a non-Google archive, visit here: 
http://www.mail-archive.com/jsmentors@googlegroups.com/

To unsubscribe from this group, send email to
jsmentors+unsubscr...@googlegroups.com

Reply via email to