防禦性設計又叫做防守設計,係喺專案設計階段諗嘅應急方案。防禦式設計係諗住用家可能會用得唔啱嘅所有情況,用設計手法避免唔啱嘅用法,抑或降低錯誤使用嘅機會。譬如話某隻插頭需要以特定嘅方向插入插蘇度,而且呢個好重要,設計師就要諗辦法設計呢個插頭,令佢必須嚮正確嘅方向先插到入去。電源插頭大多會噉樣設計,避免火線同中心線插反。
軟件工程中嘅防禦式設計叫做防禦性編程。著名嘅梅菲定律表明咗點解要搞防禦式設計。防禦式設計係同契約式設計相反嘅一種設計方式[1]。
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)