To use the 'I' prefix for interfaces or not to

前端 未结 20 1779
长情又很酷
长情又很酷 2021-02-01 02:54

That is the question? So how big a sin is it not to use this convention when developing a c# project? This convention is widely used in the .NET class library. However, I am not

20条回答
  •  谎友^
    谎友^ (楼主)
    2021-02-01 03:32

    Cannot believe it that so many people hate the 'I' prefix. I love the prefix 'I'. Here is why:

    • Are abstract and interface different? Yes
    • Do I care the difference as a developer? Yes, but not always.
    • When do I need to care?

    Design discussion(When I draw on the board, prefix 'I' clearly telling everyone it's an interface) Read existing code(When I see prefix 'I', clearly I know it's an interface. There'are exceptions for words start with 'I', but very few cases)

    • Do I always need 'I'? No. But I want consistency, so YES.

    With just one prefix 'I', it avoids so much communication overhead.

提交回复
热议问题