473,385 Members | 1,925 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

The 'Interface' Type - Unique to .NET?

In OOP literature we read frequently about "interface" - a term which is
apparently used to mean different things depending on context and possibly
language.

..NET however provides for the Interface type - as a specific and unique type
(amongst the class, struct, enum, etc types). There is no ambiguity about
its meaning; it's a very specific thing (a .NET type) independent of
context.

My question: I am wondering of other OOP languages like Smalltalk and Java
provide an interface type as well - or if 'interface' is a type unique to
..NET.

Thanks.
Mar 16 '06 #1
18 1518
Jordan,

Java also offers interface types, in a way very similar to .NET.
The concept of interface was first used in the language Objective C.

Regards - Octavio
"Jordan" <A@B.COM> escribió en el mensaje
news:Of*************@TK2MSFTNGP12.phx.gbl...
In OOP literature we read frequently about "interface" - a term which is
apparently used to mean different things depending on context and possibly
language.

.NET however provides for the Interface type - as a specific and unique
type (amongst the class, struct, enum, etc types). There is no ambiguity
about its meaning; it's a very specific thing (a .NET type) independent of
context.

My question: I am wondering of other OOP languages like Smalltalk and Java
provide an interface type as well - or if 'interface' is a type unique to
.NET.

Thanks.

Mar 16 '06 #2

Well, it allows for an /interface/ as in a class that can be an
interface with interface methods.

But there is (in Java) no 'interface' type or keyword.

MyClass implements MyInterface

Where MyInterface is just a class built to the rules of a java interface.

Octavio Hernandez wrote:
Jordan,

Java also offers interface types, in a way very similar to .NET.
The concept of interface was first used in the language Objective C.

Regards - Octavio
"Jordan" <A@B.COM> escribió en el mensaje
news:Of*************@TK2MSFTNGP12.phx.gbl...
In OOP literature we read frequently about "interface" - a term which is
apparently used to mean different things depending on context and possibly
language.

.NET however provides for the Interface type - as a specific and unique
type (amongst the class, struct, enum, etc types). There is no ambiguity
about its meaning; it's a very specific thing (a .NET type) independent of
context.

My question: I am wondering of other OOP languages like Smalltalk and Java
provide an interface type as well - or if 'interface' is a type unique to
.NET.

Thanks.


Mar 16 '06 #3
Thanks, John!

I've been out of the Java world for a while...

Regards - Octavio
"John Bailo" <ja*****@texeme.com> escribió en el mensaje
news:Z7********************@speakeasy.net...

Well, it allows for an /interface/ as in a class that can be an interface
with interface methods.

But there is (in Java) no 'interface' type or keyword.

MyClass implements MyInterface

Where MyInterface is just a class built to the rules of a java interface.

Octavio Hernandez wrote:
Jordan,

Java also offers interface types, in a way very similar to .NET.
The concept of interface was first used in the language Objective C.

Regards - Octavio
"Jordan" <A@B.COM> escribió en el mensaje
news:Of*************@TK2MSFTNGP12.phx.gbl...
In OOP literature we read frequently about "interface" - a term which is
apparently used to mean different things depending on context and
possibly language.

.NET however provides for the Interface type - as a specific and unique
type (amongst the class, struct, enum, etc types). There is no ambiguity
about its meaning; it's a very specific thing (a .NET type) independent
of context.

My question: I am wondering of other OOP languages like Smalltalk and
Java provide an interface type as well - or if 'interface' is a type
unique to .NET.

Thanks.



Mar 16 '06 #4
"Jordan"
In OOP literature we read frequently about "interface" - a term which is
apparently used to mean different things depending on context and possibly
language.

.NET however provides for the Interface type - as a specific and unique
type (amongst the class, struct, enum, etc types). There is no ambiguity
about its meaning; it's a very specific thing (a .NET type) independent of
context.

My question: I am wondering of other OOP languages like Smalltalk and Java
provide an interface type as well - or if 'interface' is a type unique to
.NET.

Thanks.


Delphi implements Interfaces exactly like C#. Humnnn, I wonder if Mr.
Hejlsberg had something to do with that.

Cheers

Padu
Mar 16 '06 #5
"Padu" <pa**@merlotti.com> a écrit dans le message de news:
Ya********************@iswest.net...

| Delphi implements Interfaces exactly like C#. Humnnn, I wonder if Mr.
| Hejlsberg had something to do with that.

Not true. Delphi interfaces for Win32 are based on the COM specification
where you have a base interface type, either IUnknown or IInterface which
has _AddRef; _Release and QueryInterface methods. They are reference counted
and any class that supports interfaces can derive from TInterfacedObject
which implements those three methods. Every object has an interface table
and the addresses for each interface differ from the address of the
implementing object.

In C#, interfaces are their own type with no base definition. They don't
have any relationship to COM, unless a GUID is declared for them.
Implementing objects and all other interfaces implemented by that object all
return the same address. .NET interfaces are not reference counted, instead
they are just alternative references to an object which can be garbage
collected.

It is only with .NET that Delphi interfaces changed to follow the .NET
model.

Joanna

--
Joanna Carter [TeamB]
Consultant Software Engineer
Mar 16 '06 #6
John,

In JAVA, there is an interface type and keyword.

http://java.sun.com/docs/books/tutor...erfaceDef.html

Best regards,

Renze de Waal.

On Thu, 16 Mar 2006 11:26:47 -0800, John Bailo <ja*****@texeme.com>
wrote:

Well, it allows for an /interface/ as in a class that can be an
interface with interface methods.

But there is (in Java) no 'interface' type or keyword.

MyClass implements MyInterface

Where MyInterface is just a class built to the rules of a java interface.

Mar 16 '06 #7

What does 'interface' do for me that implements with an non-interface
doesn't?
Renze de Waal wrote:
John,

In JAVA, there is an interface type and keyword.

http://java.sun.com/docs/books/tutor...erfaceDef.html

Best regards,

Renze de Waal.

On Thu, 16 Mar 2006 11:26:47 -0800, John Bailo <ja*****@texeme.com>
wrote:

Well, it allows for an /interface/ as in a class that can be an
interface with interface methods.

But there is (in Java) no 'interface' type or keyword.

MyClass implements MyInterface

Where MyInterface is just a class built to the rules of a java interface.

Mar 16 '06 #8
John,

Are you sure about this?

Have a brief look at the following page:
http://java.sun.com/docs/books/tutor...erfaceDef.html

Best regards,

Renze de Waal

"John Bailo" <ja*****@texeme.com> schreef in bericht
news:Z7********************@speakeasy.net...

Well, it allows for an /interface/ as in a class that can be an interface
with interface methods.

But there is (in Java) no 'interface' type or keyword.

MyClass implements MyInterface

Where MyInterface is just a class built to the rules of a java interface.

Mar 16 '06 #9
Not to my knowledge. AFAIK Java implements an "interface" concept very
similar to that of C#, complete with the keyword "interface".

Any O-O language that doesn't support multiple inheritance has to
support something like interfaces... single inheritance with no
interface-like concept would hog-tie the programmer.

Mar 16 '06 #10
John Bailo <ja*****@texeme.com> wrote:
Well, it allows for an /interface/ as in a class that can be an
interface with interface methods.

But there is (in Java) no 'interface' type or keyword.

MyClass implements MyInterface

Where MyInterface is just a class built to the rules of a java interface.


No it's not. Try doing that with a class and you get the following
error: "interface expected here".

As Octavio says, Java interfaces are very like .NET interfaces.
Likewise, but have multiple inheritance of interface but single
inheritance of implementation.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Mar 16 '06 #11
John,

In the java definition it states that it is only possible to implement
an interface. Implements with a non-interface is not an option. Do you
have a java compiler that allows you to implement with a
non-interface?

After your post I tried to get the JDK to accept a class definition
that implements a class, but it won't let me do it (the error I get:
interface expected here).

Best regards,

Renze.

On Thu, 16 Mar 2006 12:50:25 -0800, John Bailo <ja*****@texeme.com>
wrote:

What does 'interface' do for me that implements with an non-interface
doesn't?
Renze de Waal wrote:
John,

In JAVA, there is an interface type and keyword.

http://java.sun.com/docs/books/tutor...erfaceDef.html

Best regards,

Renze de Waal.

Mar 16 '06 #12

Well this guy says you can:

http://mindprod.com/jgloss/interface.html

Is he all wet?
Renze de Waal wrote:
John,

In the java definition it states that it is only possible to implement
an interface. Implements with a non-interface is not an option. Do you
have a java compiler that allows you to implement with a
non-interface?

After your post I tried to get the JDK to accept a class definition
that implements a class, but it won't let me do it (the error I get:
interface expected here).

Best regards,

Renze.

On Thu, 16 Mar 2006 12:50:25 -0800, John Bailo <ja*****@texeme.com>
wrote:

What does 'interface' do for me that implements with an non-interface
doesn't?
Renze de Waal wrote:
John,

In JAVA, there is an interface type and keyword.

http://java.sun.com/docs/books/tutor...erfaceDef.html

Best regards,

Renze de Waal.

Mar 16 '06 #13
John Bailo <ja*****@texeme.com> wrote:
What does 'interface' do for me that implements with an non-interface
doesn't?


Try extending multiple classes, then try implementing multiple
interfaces.

(Various things like mocking are also much easier with interfaces,
although that's a separate issue.)

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Mar 16 '06 #14
John Bailo <ja*****@texeme.com> wrote:
Well this guy says you can:

http://mindprod.com/jgloss/interface.html

Is he all wet?


Well, he's got an error in his code. I've mailed him to let him know -
I suspect if you look at the same page this time tomorrow it will have
been fixed.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Mar 17 '06 #15
Bruce Wood wrote:
[...snip...]
Any O-O language that doesn't support multiple inheritance has to
support something like interfaces... single inheritance with no
interface-like concept would hog-tie the programmer.

[...snip...]

Well, Smalltalk (as a pure OO language) doesn't implement multiple
inheritance and does not know about interfaces. And I don't feel "hog-tied"
at all ;-). But then, Smalltalk isn't statically typed, so I'd like to
modify your statement:

Any statically typed language that doesn't support multiple inheritance
might benefit from something like interfaces.

Interfaces might be necessary to work around problems created by static type
checking. You will propably not need interfaces in dynamically typed
languages.
Mar 17 '06 #16
Bruce Wood wrote:
[...snip...]
Any O-O language that doesn't support multiple inheritance has to
support something like interfaces... single inheritance with no
interface-like concept would hog-tie the programmer.

[...snip...]

Well, Smalltalk (as a pure OO language) doesn't implement multiple
inheritance and does not know about interfaces. And I don't feel "hog-tied"
at all ;-). But then, Smalltalk isn't statically typed, so I'd like to
modify your statement:

Any statically typed language that doesn't support multiple inheritance
might benefit from something like interfaces.

Interfaces might be necessary to work around problems created by static type
checking. You will propably not need interfaces in dynamically typed
languages.
Mar 17 '06 #17
As others have mentioned this is 100% wrong.

Java has an 'interface' keyword.

A "class built to the rules of a java interface" is one that requires
the 'interface' keyword.
public interface TestIF {
void TestSomething();
int TestAlotOfThins();
}

Mar 17 '06 #18
Jon Skeet [C# MVP] wrote:
Well, he's got an error in his code. I've mailed him to let him know -
I suspect if you look at the same page this time tomorrow it will have
been fixed.


Yeah, you're right -- he fixed it.
Mar 17 '06 #19

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Olaf Meding | last post by:
I am having trouble with the 'User' property (get and put), found near the bottom of the IDL file listed below. The user get call seems to return None, not sure why. More importantly, is there...
21
by: Helge Jensen | last post by:
I've got some data that has Set structure, that is membership, insert and delete is fast (O(1), hashing). I can't find a System.Collections interface that matches the operations naturally offered...
1
by: petar petrov via DotNetMonster.com | last post by:
Hi to all, I need to implement the above interface in C#.NET managed application. Since I am a noob with COM i looked at MSDN article of how to invoke COM from inside managed code. However the...
11
by: Jordan | last post by:
In OOP literature we read frequently about "interface" - a term which is apparently used to mean different things depending on context and possibly language. ..NET however provides for the...
20
by: Luc Kumps | last post by:
(Sorry about the previous post, it got transmitted before it was complete) We try to separate implementation and interface defintions, but we run into a problem. I hope the guru's can solve this,...
0
by: YellowFin Announcements | last post by:
Introduction Usability and relevance have been identified as the major factors preventing mass adoption of Business Intelligence applications. What we have today are traditional BI tools that...
1
by: yadolov | last post by:
I have COM-object with Iface interface: typedef struct { .... } TStruct; interface Iface : IUnknown {
11
by: Wojciech Gryc | last post by:
Hi, I recently started using Python and am extremely happy with how productive it's made me, even as a new user. I'm hoping to continue using the language for my research, and have come across a...
1
by: =?Utf-8?B?Sk0=?= | last post by:
In an application I have an interface with methods and properties. The interface is used on a Class (ie class MyClass : IMyClassA, IMyClassB). On a windows form I define a BindingSource...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.