the differences between component diagram and package diagram

I reference Michael Feathers the author of "Working Effectively with Legacy Code" (Prentice Hall 2005)

In UML, components are groups of classes that are deployed together and packages are a general grouping device for model elements. Packages can group any model elements, even things like use cases, but in practice they usually group classes, so components and packages tend to be synonymous.

From a forum posting


Component diagram shows an encapsulated class and its interfaces, ports and internal structure consisting of nested components and connectors. It addresses the static design implementation view of a system.

Package diagram shows the decomposition of model itself into organizational units and their dependencies.

from UML 2 User Guide

Packages are grouping things. Components are replaceable parts of system. Usually packages are identified in the analysis model and components in design model. Component diagrams are used in component based development


Component diagram typically employed to illustrate interfaces. So a component might be a class or it might be a collection of classes.

A package diagram is a mechanism for you to group together related UML items, think of it as acting like (file system) directory/folder for UML.

Tags:

Uml

Papyrus