Where am I blaming the jQuery ? I was not clear enough. I suggest my strategy. Unashamedly.
Task : help to the company which tried to switch to jQuery but failed. 1. have ready: jquery.1.3.2.safe.slow.js (with all the gotchas you can think off, added ) 2. impose it 3. when dust settles on the battlefiled switch back to jquery.1.3.2.js Job done -- DBJ On May 18, 3:14 pm, Ricardo <ricardob...@gmail.com> wrote: > Anyone works within the constraints of his knowledge and tools. Not > protecting code from Object.prototype (yet) has been a design decision > to not sacrify performance just to tolerate bad practice, afaik. > > From your other example, do you think car companies should limit the > car's max speed to avoid complaints? I don't think so. > > You're repeatedly complaining about jQuery's intolerance on bad code > and flexibility at the same time. The only issue at play here is the > lack of understanding of the library, javascript and debugging by > those you mention. I mean, you're blaming jQuery on "below > intermediate" coder's errors, that's like blaming the car for a bad > driver. Fix that and everything will be fine, or just forget trying to > push the library onto unwilling developers. jQuery has few > restrictions, just reading the docs is enough to adapt, have they? > > cheers > > On May 17, 8:51 pm, DBJDBJ <dbj...@gmail.com> wrote: > > > @Andrea > > > Here is a very nice and very recent example of what am I talking > > about, please find it in the thread : "Error in attr when adding > > function to Object.prototype Options " ... > > > The proverbial Object.prototype ;o) Please go and explain to the > > developer who started this thread, why is jQuery not to blame that it > > does not work in presence of Object.prototype abuse. > > He is blaming jQuery and everyone who tried to explain why is there no > > logic in extending Object.prototype. He will rather have it, and not > > use the jQuery. > > > I (usually) do not waste time in that kind of discussions and just > > place: for ( var j in Object,prototype ) delete Object.prototype[j] ; > > on the top of "my" jQuery file. Which then I impose ;o) > > > --DBJ > > > On May 17, 2:46 pm, Andrea Giammarchi <andrea.giammar...@gmail.com> > > wrote: > > > > jQuery is a library, not a language ... new $ where $ return a new > > > something > > > else is allowed by JavaScript specs ... it is not an error, syntax > > > speaking, > > > it is just like people using whatever.toString() rather than "" + whatever > > > ... you are creating a drama over a truly simple and common mistake for > > > unskilled JS developers but still, it does not harm anybody and if the > > > application does not work is not because of new $. > > > > I am sure you have hundreds of valid arguments about their bad practices, > > > but tell them that their code is crap and cannot work because new $ is > > > allowed ( by JavaScript itself, it is NOT jQuery ) is an error as well. > > > > It is not about JavaScript panorama only, there are crap developers for > > > evey > > > languages and actually truly skilled developers are rare but nobody cares > > > that much ... I see horrors in famouse PHP CMS every day but these CMS are > > > famous .... I have seen crappy logic in pieces of Zend Framework but it is > > > suppose to be enterprise .... I cannot blame anybody using a programming > > > language in a bad way as long as results are somehow reached ... I agree > > > that this would have been a better world if every paid developers was > > > truly > > > senior but I cannot find a single argument in this thread about jQuery, > > > sorry. > > > > On Sun, May 17, 2009 at 2:00 PM, DBJDBJ <dbj...@gmail.com> wrote: > > > > > Allow me to be very clear: > > > > > Issue is in MOUNTAIN of legacy javascript/css/html ... Company X > > > > decides to improve its "portal" or whatever horrid pile of sugar they > > > > might have amassed, and then yet another team is made to do it. Which > > > > usually consist of visual basic/delphi/sql/asp "developers" who are > > > > all avid followers of jQuery. They simply include jQuery in these > > > > pages , and then ... nothing works. Then they struggle for approx few > > > > weeks and just then they declare that jQuery is "very bad" and then > > > > they either revert back to ASP or JSP or whatever horros you can think > > > > of. But. Minority admits they need to learn a bit more and then they > > > > call people in to help them out. > > > > This is where we usaly come in. And this is where we use my version of > > > > jQuery to show them where are they making mistakes and for us to > > > > understand what is going on. > > > > And then "fun" starts when the legacy code has to be removed/destroyed/ > > > > forgotten. In those moments I would like Ricardo and Andrea to stand > > > > in front of these (by now highly annoyed) managers and developers and > > > > tell them : > > > > > ".. jQuery does it work as it's supposed to, it's not it's duty to > > > > enforce > > > > good practices ... or alert users of javascript syntax errors..." > > > > > What is the issues here is the jQ usage patterns not jQ itself. And > > > > this is a very big mountain to climb for a very big portion of > > > > developers. Number of people who are beyond intermediate skills in > > > > javascript+css, is in reality very very small ... > > > > > -- DBJ > > > > > On May 16, 12:17 pm, Ricardo <ricardob...@gmail.com> wrote: > > > > > Well, you shouldn't let your clients mess with your javascript, minify > > > > > it before deploying. Anything that happens is their own problem - that > > > > > is, if you're not hired to do it. > > > > > > jQuery does it work as it's supposed to, it's not it's duty to enforce > > > > > good practices (wishful thinking) or alert users of javascript syntax > > > > > errors. > > > > > > On May 15, 8:03 pm, DBJDBJ <dbj...@gmail.com> wrote: > > > > > > > I have only clients no boses, who blame it on jQuery .... until they > > > > > > are caught that is ;o) > > > > > > I am catching them with jQ version I have "adorned" with this kind > > > > > > of > > > > > > checks like the one we are discussing here. > > > > > > You will be amazed (same as me) what are javascript/css/html > > > > > > newcomers > > > > > > capable of doing. > > > > > > One more check I am going to add is this one to stop them doing new > > > > > > $ > > > > > > () ... > > > > > > > Thanks > > > > > > > --DBJ > > > > > > > On May 15, 10:43 am, Andrea Giammarchi <andrea.giammar...@gmail.com> > > > > > > wrote: > > > > > > > > Tell your head of "whatever" that a title in a contract does not > > > > necessary > > > > > > > mean extraordinary skills and if he would like to improve his > > > > JavaScript > > > > > > > knowledge he is more than welcome in this ml ( probably more as > > > > reader ... ) > > > > > > > anyway ... > > > > > > > > function init(selector, context){ > > > > > > > if(this instanceof jQuery) > > > > > > > throw new Error( jQuery.error_code, "Can not new $()"); > > > > > > > return new jQuery.fn.init(selector, context); > > > > > > > > }; > > > > > > > > function jQuery(selector, context) { > > > > > > > return jQuery.fast ? > > > > > > > new jQuery.fn.init(selector, context) : > > > > > > > init.call(this, selector, context) > > > > > > > ; > > > > > > > > }; > > > > > > > > Conditional is a bit faster than an if but still it is something > > > > > > > that > > > > does > > > > > > > not make sense because as I said the nature of the jQuery > > > > > > > callback is > > > > dual ( > > > > > > > both function/constructor ... it does not matter which way you > > > > > > > call > > > > it, the > > > > > > > result will always be an instance of jQuery, if "you" like weist > > > > > > > time > > > > > > > writing an alread implicit "new" everywhere, it cannot be a jQuery > > > > issue, do > > > > > > > you agree? ) > > > > > > > > On Fri, May 15, 2009 at 10:20 AM, Daniel Friesen > > > > > > > <nadir.seen.f...@gmail.com>wrote: > > > > > > > > > ;) I still see an if statement there, heh. > > > > > > > > > I prefer the conditional comments + build system approach. > > > > > > > > > ~Daniel Friesen (Dantman, Nadir-Seen-Fire) [ > > > >http://daniel.friesen.name] > > > > > > > > > DBJDBJ wrote: > > > > > > > > > "... If a user uses new $ this user simply does not truly > > > > understand/ > > > > > > > > > know > > > > > > > > > JavaScript but fortunately will not harm anybody..." > > > > > > > > > > No it wont, unless this user is a team leader and starts > > > > > > > > > blaming > > > > > > > > > jQuery on everything. > > > > > > > > > And this happens much more than anyone here (it seems) > > > > > > > > > realises. > > > > > > > > > But. This is another subject. > > > > > > > > > > PS: > > > > > > > > > > jQuery.fast = false ; > > > > > > > > > jQuery.error_code = 0xABCD ; > > > > > > > > > > function(selector, context) { > > > > > > > > > if ( ! jQuery.fast) > > > > > > > > > if(this instanceof jQuery) > > > > > > > > > throw new Error( > > > > > > > > > jQuery.error_code, > > > > "Can > > > > > > > > > not new $()"); > > > > > > > > > return new jQuery.fn.init(selector, context); > > > > > > > > > } > > > > > > > > > > On May 14, 2:59 pm, Andrea Giammarchi < > > > > andrea.giammar...@gmail.com> > > > > > > > > > wrote: > > > > > > > > > >> to do that you need to change the contructor: > > > > > > > > > >> function(selector, context) { > > > > > > > > >> if(this instanceof jQuery) > > > > > > > > >> throw new Error("Can not new $()"); > > > > > > > > >> return new jQuery.fn.init(selector, context); > > > > > > > > > >> } > > > > > > > > > >> this means an extra if for each jQuery call, something not > > > > > > > > >> that > > > > welcome > > > > > > > > for > > > > > > > > >> performances reason. At the same time, jQuery itself relies > > > > > > > > >> in > > > > this > > > > > > > > >> JavaScript peculiarity, so I would not create "conflicts" > > > > between jQuery > > > > > > > > >> developers and users. > > > > > > > > > >> If a user uses new $ this user simply does not truly > > > > understand/know > > > > > > > > >> JavaScript but fortunately will not harm anybody. > > > > > > > > > >> On Thu, May 14, 2009 at 10:23 AM, DBJDBJ <dbj...@gmail.com> > > > > wrote: > > > > > > > > > >>> Ah, new $, is possible and therefore not barred ... Left in > > > > there as a > > > > > > > > >>> sort of a land-mine for the newcomers ? Or as an esoteric > > > > > > > > >>> test > > > > for GC > > > > > > > > >>> developers ? Highly useless it seems to me. > > ... > > read more » --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "jQuery Development" group. To post to this group, send email to jquery-dev@googlegroups.com To unsubscribe from this group, send email to jquery-dev+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en -~----------~----~----~----~------~----~------~--~---