http://www.perlmonks.org?node_id=126629


in reply to Re: Larry vs. Joel vs. Ovid
in thread Larry vs. Joel vs. Ovid

Well, of course I do, silly :) Be strict in what you emit and accept. Masem made clearer the browser problem. If it was agreed from day one that Web browsers weren't going to put up with sloppy HTML, then we wouldn't have the mess we have today. XHTML is a great idea which might get around this, but HTML is pretty lousy.

In general programming terms, this means laying out clear standards with a very narrow interpretation. Oh, you can interpret your client's needs all you want and you should do your best to meet them, but give them 27 ways to solve the same problem and they are going to find bugs in your code. Give them one way and and you're much happier. But make sure you solve their problem.

That's not to say that you shouldn't have multiple methods of dealing with a programming problem. It's saying that you really, really need to look at the problem carefully and determine if those multiple methods are appropriate. On Windows, you can copy selected text with File->Copy, Cntl-C, or a right click to pull up a context menu. That seems fine because different people have different methods of learning and it's appropriate to cater to those. Internally, however, they had all better call one copy routine with identical data formats.

Now, how can you guarantee that all of those methods of copying text, images, or whatever are going to do exactly what you want? That's the tough part. Frankly, nothing irritates me more than copying text from a Web page, pasting it into an email and seeing a frickin' radio button show up. That even happens when I'm sending the email in PLAIN TEXT!!! That ain't a feature, in my book. But that's the result of being liberal in what to accept. How can you be strict in what you emit if you aren't sure at any given moment what you've accepted?

There's a time and place to be liberal in what to accept, but very few get it right. It's a good theory that most should put on an ivory tower and leave there. The more complex the system, the less likely that such "liberality", if you will, is going to please every one. If you're writing a mass-market tool like an OS, maybe this is necessary. If you're writing a financial application, do you want to be responsible for explaining to the client that they "misplaced" $30,000 because you were liberal with their Accounts Receivable? :)

Cheers,
Ovid

Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.

Replies are listed 'Best First'.
(tye)Re: Larry vs. Joel vs. Ovid
by tye (Sage) on Nov 21, 2001 at 01:07 UTC

    If it was agreed from day one that Web browsers weren't going to put up with sloppy HTML, then we wouldn't have the mess we have today.

    And we might not have the popularity of the web we have today. Graceful failure is a good idea. Under your scheme all of the poor surfers of the world would be getting lots of errors from their browsers when those surfers have no control (and virtually no influence) over getting those errors fixed and many of them would have no idea what those errors mean.

    The fact is that many decided to take advantage of one half of a sound principle by completely ignoring the other half of the principle. And only having one half of that principle is certainly not a good idea.

    But putting the error checking and enforcement into a web browser client is a really bad idea. Error checking and enforcement needs to be as early in the process as possible. A much better idea would be to fix web servers so that they refuse to emit bad HTML rather than "fix" web browsers so that they refuse to display bad HTML!

    It is a good idea to be at least somewhat lenient in what you accept. It is also a good idea to note cases where you were lenient in such a way that this information is likely to make its way back to the source. That back channel is often quite difficult to implement well. But a really horrible idea for such an implementation would be browsers giving errors to web surfers.

    Now, being vague about what you accept is a bad idea. That is why the two halves need to go together. In order to be strict about what you provide, you have to define things clearly. Without that side of the coin, just being liberal about what you accept is trying to DWIM, which is (often) a nice feature of Perl but is usually a bad idea in any software that isn't interacting directly with a human.

    And do you want to be responsible for explaining to the client that the $30,000 transaction couldn't go through because something changed how much whitespace is sent?

    You can go too far in either direction. The idea of the principle is to prevent you from going too far in one direction. You are (in part) complaining about people going too far in the other.

    But the complaint about browsers being too lenient is a bad form of wishful thinking. No one will ever produce a browser that is not lenient in what it accepts -- well, if they do, it won't get used much. Now a browser that tells you that it had to be lenient has its advantages, all of which are of no use (and some distraction) to the average web surfer and so will never become widely popular. And having some magical control to force all browsers to not be lenient or to at least complain loudly when they are force to be is, in fact, a very bad idea, unless you also design a way for those browsers to direct their loud complaints back at the authors of the bad HTML.

    Go design that back channel first and then you can think about tilting against the "bad, lenient browser" windmill again.

            - tye (but my friends call me "Tye")

      tye wrote:

      Under your scheme all of the poor surfers of the world would be getting lots of errors from their browsers...

      Okay, when was the last time you got an error from an ATM because it lost some of your money, even if it's requesting it from a different bank? ATMs work because the design of the ATMs communication protocol was standardized before the ATMs communicated with different banks and this design was adhered to.

      In your example above, if the standards were clear from the beginning and the companies that made the browsers put out standards-compliant browsers, the designers would be getting the errors, too! They'd scratch their heads and their buddy Bob would say "Actually, you need to put quotes around attribute values". Aah! The light would dawn, the problem would be fixed, and we'd probably have a better Web, albeit a potentially smaller one. Of course, that's not reality, so we're stuck.

      And do you want to be responsible for explaining to the client that the $30,000 transaction couldn't go through because something changed how much whitespace is sent?

      Yes!!!

      "Look Mr. CEO. You said you didn't want any bugs and it says right here in ar_post() API that no white space is allowed between the 12 digit Account Number and the 9 digit Routing Transit Number. If your programmers don't adhere to the specifications we send, how can we be sure that they are sending what they're supposed to?"

      Admittedly, that's an overly simplistic example and not flexible enough for real world work. My point is not that we should be so rigid that we break with the slightest gust of wind. My point is that we shouldn't be so flexible that we fall over :)

      Cheers,
      Ovid

      Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.