Feb 21st, 2009
by dagfinn.
Image by libbyrosof via Flickr
The debate on the “one assertion” principle continues. Pádraic Brady and I agree on the general principle, but since he is so categorical in his second article, I needed to inspect his reasoning more closely. It’s clear that our disagreement is more than superficial. The more I think about it, the [...]
Feb 15th, 2009
by dagfinn.
Image via Wikipedia
Pádraic Brady pleads for the principle that a unit test method should have only one assertion. His point is perfectly valid; there are several good reasons why one assertion per method is a smart guideline when writing unit tests. But since he drags up the term “lazy”, I feel the need for soul-searching [...]
Feb 14th, 2009
by dagfinn.
Image by Franco Folini via Flickr
As Kevlin Henney pointed out at the PHP UK Conference 2007, PHP type hints are not hints.
Rather, they are instructions to PHP to check the type. That may not be terribly important,
but it’s worth pointing out, since confusing terminology is less confusing if you understand how it’s confusing.
Anyway, I hereby [...]
Feb 3rd, 2009
by dagfinn.
Image by cackhanded via Flickr
Davey Shafik discusses return values from functions. In the specific case of a function that returns values from a database, he wants to return false on error and an empty array if the data set is empty. He also has a reason for that:
“However, it’s very rare that I care about [...]