ONJava.com -- The Independent Source for Enterprise Java
oreilly.comSafari Books Online.Conferences.

advertisement

AddThis Social Bookmark Button
Article:
  Understanding Interfaces in .NET
Subject:   interface naming
Date:   2003-07-04 14:51:45
From:   anonymous2
Response to: interface naming

I think it is a matter of feeling:
If you handle an object and you write code
you feel different, if you handle objects of any type IXxxxx or if you handle objects of the type Xxxx. You always know that you dont really got an
object of the type IXxxx. You only got an object, which ALSO can do the things of IXxxx. It is sometimes really different if you just have a inherited class type object or a interface TO an object. If you dont FEEL right you wont CODE right. Of course your tool can tell you, if you have an interfaced or an inherited object. But this is only implicit. The explicit way is to use IXxxxx.


For example in our company we have at the first look "silly" prefix for function/method parameters:
We just write a little "y" as prefix.


That is also a matter of "feel". You feel that you handle a parameter. If you want to code straight forward, you want to always use the same schema:
You have INPUT, do something, you have OUTPUT.


For example:


public int Add(int yA,int yB)
{
int returnValue=yA+yB;


return returnValue;
}


It is just also a "silly prefix".


But it helps you to feel the correct way.
I think there is the same way to the IXxxxx.
It just helps you to feel the correct way.


Please reply with comments!!