realbasic-nug
[Top] [All Lists]

Re: Interfaces and Computed Properties

To: REALbasic NUG <realbasic-nug@lists.realsoftware.com>
Subject: Re: Interfaces and Computed Properties
From: Norman Palardy <npalardy@great-white-software.com>
Date: Wed, 26 Nov 2008 22:40:09 -0700
Authentication-results: mx.google.com; spf=neutral (google.com: 74.124.194.228 is neither permitted nor denied by best guess record for domain of realbasic-nug-bounces@lists.realsoftware.com) smtp.mail=realbasic-nug-bounces@lists.realsoftware.com
Delivered-to: listarchive@realsoftware.com
In-reply-to: <D777EFE4-6977-4EA2-A3C0-EC3609BBB2C0@verizon.net>
References: <4F4D1ADF-52CE-4EBA-9346-9BE37992CCDD@xochi.com> <1ED2BB86-1E43-4A4C-8245-F8D587E28BC2@great-white-software.com> <BFB05065-1FC3-4400-A27F-1448615FFD11@xochi.com> <33cbfa100811261510l7803122fu2592dd1d7f03848b@mail.gmail.com> <421C4E27-0784-4D03-B28D-EB52A783BADE@great-white-software.com> <33cbfa100811261628h68d4a3c2xd11a3ca8d3c9881e@mail.gmail.com> <007DA3B0-FAE4-4E85-81E4-A0122C860DC1@great-white-software.com> <D777EFE4-6977-4EA2-A3C0-EC3609BBB2C0@verizon.net>
Reply-to: REALbasic NUG <realbasic-nug@lists.realsoftware.com>
Sender: realbasic-nug-bounces@lists.realsoftware.com

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>


<Prev in Thread] Current Thread [Next in Thread>