implementationumlclass-diagramcomponent-diagram

Component diagram versus Class diagram?


class and package diagrams model logical design of software

component diagram models implementation view

Could you please clarify the above difference through a very short example?


Solution

  • The answer lies in your question itself. How do you think, a software is designed and a software is implemented?

    In design, we develop blueprint for designing workable software. This blue print involves a model which can be translated into software, while implementation involves the conversion of that model into actual software i.e code.

    Similarly, A component is generally bigger and more abstract than a class. While a class is a relatively low-level blueprint(design) for an object instance, a component might be a set of classes which together forms an encapsulated module(implementation) you then interface with. A component might even contain no classes at all!

    Now, component diagrams don't show the actual code but the dependencies between the actual implemented software components (these components can be anything like executables,files,folders etc. As for example :-

    enter image description here

    As I have already discussed; Class diagram is UML structure diagram which shows structure of the designed system at the level of classes and interfaces, shows their features, constraints and relationships - associations, generalizations, dependencies, etc. example of a class diagram :

    enter image description here

    I hope that I made myself clear.