Pros and cons of organizing packages in a Java project

As the projects I'm working on are growing more and more, I'm starting to be unsure of class separation into packages. Suppose that a project has many layers, and in these layers there are interfaces and implementation, and even more sublayers (components). I always get a lot of packages that start to get a little confused.

Therefore, I want to know that other people are suitable for working with packages. Do you prefer to have many packages with multiple classes or multiple packages with many classes? Do you prefer to separate implementations from interfaces? And so on ... In general, your daily habits of using packages and the pros / cons of your approach.

Thanks for your posts.

+3
source share
2

, .

, , - . , , .

, :

  • . , .
  • . (, , ..) .

, , .

, . , , , .

, . , , , , . , , , .

, -, , , . , . ( , .)

, , . com.foo.Bar, , , com.foo.bars.CrowBar, com.foo.bars.TaskBar. , , com.foo.moduleX.bars.CrowBar com.foo.bars.moduleX.CrowBar, , .

, , , , : , , .

+10

, ( Eclipse:), , .

- (DAO) / , -.

, . , OSGi .

: ( , ) , .

+2

Source: https://habr.com/ru/post/1796128/


All Articles