A typical J2EE project, package design has matured through the routine, such as the two domain, dao, service, action, etc., functions have been decomposed and clear comparison of a single, circular to rely on such a case not much. Java in general, such as Server Procedure, the client program and general framework of development, package design and there is no routine to follow, after all, as a result of the application and different types of business, think of the design of generic routines is unlikely. This time to follow some of the principles is more important than mechanically. In the "Agile Software Development", a book on the design of packet-depth discussion, although the target is released in terms of binary packages, but the design of java package from the same significance, such as cohesion package, reusable and stability of the stress that the dependence of, which are more general concept is not so intuitive, the need for practical application carefully summarized and reconstruction, to move closer to these principles.

I think of a more intuitive way: For a description of a package, you can be a concise summary, then, that is, functions or packages can be clear and concise introduction, which is a package designed to measure whether it is reasonable The most simple method. If so, obviously this package a very good cohesion, all the categories have serve a purpose, and thus brought about the possibility of reuse (reuse of fact I do not cold, in addition to tools outside the truly important things in less of and less cohesion is of concern); the other hand, the packet may be too much to bear, or to rely on too many responsibilities, careful reconstruction and separation is needed. Packet interface design to follow the same principle of separation, isolation and realization of the interface in different packages, the client will not know the realization of concrete, and also to ensure the realization of a one-way dependent on the interface. Of course, this would require the introduction of factory-type, plug-ins or the IOC container to instantiate implementation class is responsible for.