On 26-Nov-08, at 6:36 PM, Karen wrote:
On Nov 26, 2008, at 7:59 PM, Norman Palardy wrote:
pure abstract classes are "interfaces" in C++ .. and you dont put
properties in them either :)
REALBasic is not C++
I'm just saying that when you use design by contract you specify the
contract or API - not the data that might help implement the API and
you don't tie implementors to a specific way of doing it.
C++, which Lars IS familiar with, has "interfaces" - pure abstract
classes. And you don't put properties in those either or you end up
with partially abstract classes which start to need "default"
implementations - something you cannot do in RB with just an interface.
This is true in other languages that support interfaces.
Besides religion, what would be the downside to being able to
specify properties that have to exist (without specifying if they
are computed or not). I've never understood what would be so bad
about that... and it sure could make life easier sometimes!
Interfaces specify an API - a contract that the implementor will
adhere to as far as what methods are present.
A property says "and this is how you do it" which ties every
implementation that that ONE way of doing it.
And if any implementor does not need or want that property - too bad.
They get it anyways and now it's just useless baggage that they lug
around.
If you need / want a property use a method pair.
sub myProperty() as Integer
sub myProperty(assigns i as integer)
and there's myProperty
To the consumer of that class there's no difference between the method
pair and a property (which I've always really liked in RB)
AND it allows implementors the flexibility to implement that
"property" however is appropriate for that implementation.
That's entirely the point of an interface - tie every implementor to
an API NOT the specifics of how to implement it.
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>
|