Matt Kruse said:
It appears so, but I think we're now discussing the broader
issue, not that specific case.
And that specific case still illustrates that browser sniffing does not
necessarily result in less complex testing.
True, such code exists, but it's also not relevant to jQuery.
Didn't you just say that it was the broader issue that was being
discussed, not the specifics of JQuery?
Includes the statment:-
| Additionally, in Internet Explorer, doing object detection checks
| can, sometimes, cause actual function executions to occur. For
| example:
|
| if ( elem.getAttribute ) {
| // will die in Internet Explorer
| }
|
| That line will cause problems as Internet Explorer attempts to
| execute the getAttribute function with no arguments (which is
| invalid). (The obvious solution is to use
| "typeof elem.getAttribute == 'undefined'" instead.)
At which point I stopped reading. I am hardly going to be interested in
the opinions of someone who cannot even tell what their own code is
doing and retreats into fantasy explanations as a result.
Includes the statment:-
| And a line that says if (Prototype.Browser.IE) is much more
| comprehensible (and honest) than a line that says
| if (document.all && !window.opera).
But on the whole that page illustrates feature testing being superior to
browser sniffing, and the only case where it purports not to looks like
a lack of imagination on the part of the author. And it is written by
one of the authors of Prototype.js, so it completely side-steps the
possibility of designing issues out of the system, because for
Prototype.js replacing the whole thing with a better designed
alternative is unthinkable.
That page does not include a single suggestion that browser sniffing
would ever be superior to feature detection for any reason.
Perhaps if you are seeking logical perfection,
I am seeking the difference between knowing and believing.
yes. Practically, perfection isn't required.
Whether perfection is required or not is irrelevant. Your argument took
the form of; knowing this and knowing that then the other, which is a
fine form for an argument to take. If, on examination, that argument is
actually; believing this and assuming that then the other, it becomes a
much less substantial position to argue. That makes it quiet important
to understand what it takes for believing to become knowing in this
context.
Remember that you were the one making the strong statements like "the
problem is known to only exist in a single browser".
Of all the browsers you claim exist, I'll
bet that I haven't seen hardly any of them
visit the sites I care about.
How would you expect to have "seen" them? Server logs recording User
Agent headers perhaps? Hasn't it been pointed out that the vast majority
of User Agent headers are designed to be spoofing the User Agent headers
of other browsers? If IceBrowser sends a user Agent header that is
indistinguishable form that of IE how do you expect to be able to
distinguish it from IE?
Devoting effort and thought to a fringe user who might
someday visit my site with a browser I don't know about
is not something I really care that much about.
Evidently. It is not something I care about either, but that is because
I do not care about the type or version of browser that people use at
all so such a visit would require no special interest.
Which may be a fine area to be in.
Generally, not while writing computer programs, and certainly not when
it was avoidable.
And yet the code that exists seems to work just fine for
every single user I've ever cared about, without exception.
That is a pointlessly circular argument. If you define the users you
care about as the ones for whom the use of poor techniques is not a
problem then the statement is self evidently true, though not
informatively so.
But an important question in relation to what you may or may not care
about is whether that is relevant to what you do. If you only ever write
code to satisfy your own perceived needs, on your own web site, fine, it
is your choice to make. Otherwise code written is intended to achieve
something for someone else, and the question of what should and what
should not be cared about is theirs to decide, not yours.
Believe me, I understand your theoretical/logical argument.
If you're seeking perfect logical consistency similar to a
mathematical proof, you are absolutely correct in your arguments.
If I am seeking practical, robust, reliable and easily maintained
browser scripts I am also correct.
But sometimes "good enough" really _is_ "good enough".
And sometimes "good enough" is an illusion that will evaporate over
time. And sometimes when it evaporates the person left carrying the can
is not the person who walked away having delivered something that only
looked "good enough".
Why kill yourself trying to create an exhaustive and
bullet-proof detection algorithm that may not even be
possible?
Why walk away from the possibility of creating and exhaustive and
bulletproof algorithm (which, once created, will serve for its purpose
for ever) before being certain that it is impossible?
You could instead solve the case for every known
user and every probable future user of your site
with some simple code,
Where is the "instead" about it? Feature detection is not inherently
complex, and browser sniffing is not inherently simple (even while being
inherently unreliable). And it precisely in the area of accommodating
future users that browser sniffing reveals one of its major weaknesses.
'If I could ... with browser sniffing' then that would be one thing, but
it has been tried and it has become blatantly obvious that 'if not then
....' is the position we are in.
and leave open the possibility that a rare case may exist
in the future that may make you want to reconsider your
code. Or download the latest version of your library and
find that 20 others have already investigated the problem
and fixed it for you.
Again, perhaps technically true.
No "perhaps", it is technically true, has been true for the best part of
a decade, and is demonstrated to be true by all the browsers that are
never "seen" in server logs but exist regardless.
But in reality, it is a source of information.
No, it is an arbitrary sequence of characters.
And it's correct for almost every single user
It is "correct" for all users. It is not possible for an arbitrary
sequence of characters to be incorrect so long as it is a sequence of
characters.
with the exception of some people who purposely try to
provide inaccurate information.
These "people" including the authors of all those web browser you have
never "seen", because they have set up the default UA strings in the
browsers they author so that they are indistinguishable from IE's.
Personally, I don't care about those people. That's not
perfect, but it sure is practical.
Where "practical" is defined as not contradicting what you choose to
care about.
You can't prove it conclusively.
You can if you do test in every browser, but nothing short of that would
"demonstrate" anything.
But, for example, I often code for
apps that support only IE or maybe IE/FF.
So do I, for commercial web application development that is quite a
reasonable criteria as it covers all available OSs and if someone is
purchasing a web application to use then they should not have a problem
with getting a supported browser (or doing any necessary configuration
(in an appropriate security zone)). It would be very sub-standard for a
public web site or e-commerce site design.
I can demonstrate well that there are no known issues
outside of my supported browser environment.
Yes you can, because you only have at most two browser to worry about.
And for my case, browser detection (when required) works
flawlessly, without exception.
But not any more flawlessly than the alternatives, and with only two
browsers and maybe 2 or 3 versions of each to worry about, feature
testing becomes extremely simple too. Indeed, working with just IE and
Mozilla/Firefox the need to have any branching at all is reduced to
probably less than 4% of the code, and no branching means no testing at
all.
I agree. And where practical, that approach is always preferred.
But most of assertions of impracticality are actually just
manifestations of a lack of imagination or a lack of understanding on
the part of the person making the assertion. Which is why I frequently
challenge people who make such assertions to render than sufficiently
concrete that they could be tested for their veracity. To date you are
the only person who has ever risen to that challenge, and when you have
you have been shown either that a feature test is possible/practical, or
that it would be trivial to design the issue out of the system.
Anyway, to your argument. You started off saying that "knowing ..." and
"demonstrating ..." supported browser sniffing, and ended up saying that
'bereaving ...', 'assuming ..' and 'not caring about ...' justified
browser sniffing. I am not impressed with that, but not particularly
surprised.
Richard.