|Think about Loose Coupling|
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? :)
Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.