Re: Re: Design by Contract

From: Date: Tue, 10 Feb 2015 00:24:20 +0000
Subject: Re: Re: Design by Contract
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-82322@lists.php.net to get a copy of this message
Hi! > constraints. Type check is one of them. There are many people argue "This > language is secure and robust because it has _static_ types". These people are wrong. Languages can't really be secure or robust, only code implemented in these languages can, and we have witnessed many examples of vulnerable code written in pretty much any widely used language. Having strict typing may protect against some very basic errors, but in well-designed and well-tested software such errors would be rare, and in badly designed software type strictness would not save you. > Here comes DbC, once we have contracts for pre/post conditions. We are > safe from calling functions with invalid parameters during development, yet > we have optimum performance for production since there is zero contract > checks > with production mode including opcode. That assumes perfect test coverage in development, both code-wise and, more importantly, data-wise. Which is impossible. While having assert primitives that can be turned on and off looks like a useful concept to me, I don't think it is some kind of magic solution that will change everything. -- Stas Malyshev smalyshev@gmail.com

« previous php.internals (#82322) next »