Intro Interface Implementations Naming

Intro Interface Implementations Naming

Intro Interface Implementations Naming

Intro

在建立AbstractFactory時,它是一個Interface。而且會有一個具體的class來Implement。
要如何命名這個Interface呢? IShapeFactory或ShapeFactory?

建議是不加額外的修飾I,多餘的字首I,是會讓人分心的事物。因不用讓使用者知道是interFace
而是讓使用者知道是ShapeFactory,所以Interface Implementations兩者之一需要進行命名
的話,會選擇命名Implementations,可能是ShapeFactoryImp或CShapeFactory,都比
IShapeFactory相對好。