Prefixing interfaces with I?

前端 未结 3 1504
北荒
北荒 2020-12-24 02:05

I am currently reading \"Clean Code\" By Rober Martin (UncleBob), and generally loving the musings of UncleBob. However, I got a bit confused, when I read that he avoids pre

3条回答
  •  旧巷少年郎
    2020-12-24 02:44

    If you're talking about .NET, then interfaces with I at the beginning are so ubiquitous that dropping them would confuse the hell out of everyone.

    Plus I'd much rather have

    public class Foo : IFoo {}
    

    than

    public class FooImpl : Foo {}
    

    It all boils down to personal preference and I did for a while play with the idea myself but I went back to the I prefix. YMMV

提交回复
热议问题