I disagree that a property should imply O(1), this is an implementation detail that might change. For example an array based collection will almost always have a count property that is O(1), but a liked-list based collection will almost always be O(N).<br><br>On Friday, 29 January 2016, Michael Wells &lt;<a href="mailto:michael@michaelwells.com">michael@michaelwells.com</a>&gt; wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><br><div><blockquote type="cite"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
&gt;&gt; &gt; ,----[ Side Note, since you mentioned efficiency ]<br>
&gt;&gt; &gt; | I originally wanted to uphold the principle that, “if it isn&#39;t O(1),<br>
&gt;&gt; you<br>
&gt;&gt; &gt; | don&#39;t make it a property.”  The implication is that on collections,<br>
&gt;&gt; &gt; | “count” would be a method.  That would include Array, for which<br>
&gt;&gt; counting<br>
&gt;&gt; &gt; | the elements *is* O(1).  Some people argued that:<br>
&gt;&gt; &gt; |<br>
&gt;&gt; &gt; | 1. The idea of writing “a.count()” instead of “a.count” to count the<br>
&gt;&gt; &gt; |    elements of an Array was absurd.<br>
&gt;&gt; &gt; | 2. Programmers don&#39;t draw conclusions about efficiency based on whether<br>
&gt;&gt; &gt; |    something is a property.<br>
&gt;&gt; &gt; | 3. The fact that Array would have an O(1) non-property that *could*<br>
&gt;&gt; have<br>
&gt;&gt; &gt; |    been a property (if it weren&#39;t for CollectionType conformance)<br>
&gt;&gt; &gt; |    undermines any communicative power that you might get from using<br>
&gt;&gt; this<br>
&gt;&gt; &gt; |    distinction to choose properties.<br>
&gt;&gt; &gt; |<br>
&gt;&gt; &gt; | I did not win that argument :-)<br></blockquote></blockquote></div><br><div>I strongly agree that properties imply O(1) and most programmers I’ve ever worked with make the same assumptions. Even if the documentation says otherwise, code like</div><div><br></div><div><font face="Menlo">fibonacciNumbers.count</font></div><div><br></div><div>looks as if you’re accessing a c-style field ‘count’ and that implies (at least to me) that it is a near-costless operation. Some of the biggest design mistakes I’ve ever seen use properties that trigger time-consuming operations like database or network access. </div><div><br></div><div>And I don’t think having to use <font face="Menlo">a.count()</font> is absurd. :-)</div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div></div></blockquote><br><br>-- <br>  -- Howard.<br><br>