I'm sorry, but a "public internally implementable interface" just sounds
like a nightmare.

Keep it simple.  Interfaces are interfaces.

I think too many people focus on contorting object-oriented programming
languages into things that they are not.  They are not UML, they are not
rights management systems, they are not policy enforcers.  They are a means
to express imperative algorithms.

Keep it simple.  Preventing someone from implementing an interface will just
cause unforeseen problems later.

-- arlie


-----Original Message-----
From: Moderated discussion of advanced .NET topics.
[mailto:[EMAIL PROTECTED] On Behalf Of Marek Malowidzki
Sent: Thursday, April 15, 2004 9:58 AM
To: [EMAIL PROTECTED]
Subject: Re: [ADVANCED-DOTNET] Public abstract classes with internal
abstract methods

> Instead of an unneeded abstract method, I'd rather get the same effect
using
> an internal constructor.
>
> public class BaseClass
> {
>     internal BaseClass()
>     {
>     }
> }

Or, in managed C++, the "private public" access specifier.

The original post touches one interesting issue: providing an interface for
an assembly's client (where "interface" means either real interface or a
class) that assures that its implementation will be of a given type (often,
coming from the assembly). For example, when someone needs to develop a
package that uses interfaces but internally casts them to an assembly's
private type (to allow for operations or access state that should not be
seen by the client). This is often not elegant but greatly simplifies the
package's overall interface.

With classes, with the internal constructor, or the foo() approach, it is
possible. Using interfaces is often a better choice, but the problem is that
anyone could implement it. So I personally sometimes feel it would be cool
to have "public internally implementable" interfaces. E.g., through adding a
"constructor" notion to interface (just to mark the inheritance access):

public interface IMySmartInterface
{
    internal IMySmartInterface();    // must be always parameterless and
cannot have implementation in implementing classes
    void DoSomething();                // common methods: always public
}

Of course, I am speculating only.

Marek

===================================
This list is hosted by DevelopMentor�  http://www.develop.com
Some .NET courses you may be interested in:

NEW! Guerrilla ASP.NET, 17 May 2004, in Los Angeles
http://www.develop.com/courses/gaspdotnetls

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to