Are progressive enhancement and graceful degradation same thing, practically speaking?

痴心易碎 提交于 2019-12-06 10:17:33

问题


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.



来源:https://stackoverflow.com/questions/3089843/are-progressive-enhancement-and-graceful-degradation-same-thing-practically-spe

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!