Use verbs with functions, nouns with classes – what about interfaces? [closed]

Ok, I understand the normal conventions of using verbs with functions and nouns with classes. What about interfaces? Is there any methodology when coming up with interface names that may not be that obvious?

Just to make it clear, I’m not talking about whether to put an “I” in front of the name or if to use camelCase or PascalCase. I’m wondering about the method of figuring out a clear, semantic name for an interface.

EDIT
I’m obsessing on how to name an interface in the clearest way. I guess it just needs to be a noun too because when I think of naming classes I think of the closest “real” world object it can relate to. I suppose real world interfaces are things like a keyboard, mouse, remote control, ATM screen. Those are all nouns. Anyhow, any additional insight on a good way to formulate interface names would be appreciated.

3

I’d say it depends on what the interface defines. In some cases when the interface is rather specific and detailed, I think a noun is best. Examples are IList, ICollection.

Sometimes though an interface is more about adding certain general features to a class. In that case I think an adjective is best. Examples are IDisposable, IEnumerable, …

Maybe another way to think about this is how many “abilities” your interface defines.

For example, the IList<T> interface defines these abilities: Add, Clear, Contains, Insert, Remove, … These are all properties of a list so IList is a good name.

IDisposable on the other hand only defines one ability: Dispose. So it is suited for anything that is disposable. Hence the name IDisposable.

3

An interface describes behavior so the names should say so. I am not sure about a rule for this but you will know the name when you hear it.

Some examples:

Flyable      - Can Fly
Workable     - Can work
Negotiatable - Can negotiate.

I think it is not proper to name interfaces with I and call Set with ISet because, as a developer, you should not be worried whether it is an interface or a class. I see this practice does not exist in Java now.

4

Since an interface is really just an expression of the “what” but not “how” of a type, I would name them in the same way that you name classes, at least from a parts of speech perspective. The only thing I might add to this is that they’re often going to be more general than the specific implementers (e.g. “Customer” interface may have “ProspectiveCustomer” and “PayingCustomer” implementers).

0

Quick Answer: Interface is more about addition of a SET of abilities, features, common boundaries or interconnections between entities, classes, models, concepts, etc..

Thing about adding common behavior to classes and entities, and then a good meaningful name will come up to identify the set of realted features.

Interface Naming like : IStateMachineBuilder, IUserContextProviderBuilder, IEntityBuilderBuilder, IActiveAware, etc. probably explain the concept.

1

An interface is used like a class. Therefore, it should also be named with a noun when you name classes with nouns. Prefer abstract nouns, for example “Vehicle” when the classes are “Car” and “Truck”.

It depends, if the interface contains only methods it will be good to name it using a verbs like “Actions” where as if it represents a generic class wchich contains static , final fields then we can use a generic Noun just like “Vehicle”

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật