When to Use Package Diagrams and Collaborations

When to Use Package Diagrams and Collaborations

Packages are a vital tool for large projects. Use packages whenever a class diagram that encompasses the whole system is no longer legible on a single letter-size (or A4) sheet of paper.

Packages are particularly useful for testing. Although I do write some tests on a class-by-class basis, I prefer to do my unit testing on a package-by-package basis. Each package should have one or more test classes that test the behavior of the package.

I find collaborations useful whenever you want to refer to a particular interaction. Parameterized collaborations are useful when you have several similar collaborations in your system.