Hi Sven,

On Thursday 29 September 2016 22:09:27 Sven R. Kunze wrote:
> 
> Am Donnerstag, 29. September 2016 20:26:54 UTC+2 schrieb Aymeric Augustin:
> 
> > Generally speaking, properties are expected to be cheap and methods can be
> > expensive. In my opinion, for lack of a better guideline, we should stick
> > to this one. `is_valid()` falls into the expensive category, and for this
> > reason it should remain a method.
> 
> Oh, I've never heard of this guideline. I just thought that properties
> should be used to reduce visual noise (such as parentheses and "get_" or
> "set_" prefixes.) or to replace a static attribute with a dynamic one.
> Cheap vs. expensive never played a role so far (at least where I worked).

I'm completely with Aymeric on this one. The parentheses are not just noise, 
they're a strong hint about the price of computation expected, and also about 
the expectation of exceptions popping up. Properties hiding complex code are 
downright misleading in my book, and "is_valid()", which may call user code, 
certainly qualifies as complex.

Have fun,
        Shai.

Reply via email to