Are progressive enhancement and graceful degradation basically the same thing?
问题:
回答1:
Not quite. They tackle similar problems, but from different angles.
"Graceful degradation" implies you have spiffy functionality, and can deal with it being less spiffy (but still need it to work somehow) in browsers that don't support it. "alt" attributes on images, and the <noscript>
tag, are examples of this.
"Progressive enhancement" implies you're starting out with just basic content, and want to add spiff for browsers that support it without breaking the site for those that don't. As an example of this, imagine you have a list of links that serves as your nav menu. It works fine, but if you add some javascript it can give you flyout menus, tooltips, and all that.
Basically, progressive enhancement says "start out with good content, and make it better when you can", and graceful degradation says "i assume you can do this cool stuff...but if you can't...well...here's some other crap you can do."
Guess which one's better.
回答2:
Graceful degradation is one of the advantages or outcomes of progressive enhancement. If you do PE correctly, if any part of the system fails (like Javascript), the page will still work correctly (if not beautifully).
You might also hear "separation of concerns", which is a discipline that is part of the above. Eg, no CSS in your HTML, no HTML in your business logic. Each part can be maintained independently, and the failure of one part won't cause the failure of other parts.