문제

I've seen the organization below, but was wondering if there are any established conventions or helpful advice for organizing classes and interfaces?

  • [domain].[name]
    • foo
      • impl (contains classes with abstract and concrete implementations)
      • intf (contains interfaces)
도움이 되었습니까?

해결책

There is no hard and fast rule and your mileage may vary...

However, I recommend keeping related public interfaces and implementation code in the same package. In that way, the interfaces, enums, constants, factory classes, or whatever else needs to be publicly available is public, while implementation classes can be mostly or entirely private or only package visible. Putting implementation classes in a separate package will force some details to be public which would not otherwise have to be exposed.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top