防御性设计

防御性设计也稱為防守設計,是在專案設計階段的应急方案。防御式设计是考慮使用者可能會錯誤使用的所有情形,用設計手法避免錯誤使用,或是降低錯誤使用的機會。例如,假如某一個接頭需要以特定的方向插到插座中,而且這個非常重要,會設法設計此接頭,讓接頭必需依正確的方向才能插入插座中。電源插頭多半會依此方式設計,避免火線和中心線插反。

带两个按钮的切纸机,使用者需要同时按住两个按钮才能切纸。该设计是为了防止操作者切到自己的手。

軟體工程中的防御式设计稱防御性编程。著名的摩菲定理說明了為何需要防御式设计。防御式设计是和契约式设计相反的一種設計方式[1]

例子

  • 許多电子连接器會考慮防御式设计,故意設計成非對稱。

相關條目

參考資料

  1. (HTML). Internet: Wikipedia. 2017-05-17 [2017-07-25]. (原始内容存档于2007-12-05) (英语). The DbC approach assumes all client components that invoke an operation on a server component will meet the preconditions specified as required for that operation. Where this assumption is considered too risky (as in multichannel client-server or distributed computing) the opposite "defensive design" approach is taken, …
This article is issued from Wikipedia. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.