防禦性設計

出自維基百科,自由嘅百科全書

防禦性設計又叫做防守設計,係喺專案設計階段諗嘅應急方案。防禦式設計係諗住用家可能會用得唔啱嘅所有情況,用設計手法避免唔啱嘅用法,抑或降低錯誤使用嘅機會。譬如話某隻插頭需要以特定嘅方向插入插蘇度,而且呢個好重要,設計師就要諗辦法設計呢個插頭,令佢必須嚮正確嘅方向先插到入去。電源插頭大多會噉樣設計,避免火線同中心線插反。

軟件工程中嘅防禦式設計叫做防禦性編程。著名嘅梅菲定律表明咗點解要搞防禦式設計。防禦式設計係同契約式設計相反嘅一種設計方式[1]

例子[編輯]

  • 好多電子連接器會考慮防禦式設計,特登設計成唔對稱嘅。

睇埋[編輯]

參考[編輯]

  1. "Design by contract" (英文). Internet: Wikipedia. 2017-05-17. 歸檔時間2016-01-12. 喺2017-07-25搵到. 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, …{{cite web}}: CS1 maint: bot: original URL status unknown (link)