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?
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?
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 :-
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 :
I hope that I made myself clear.
implementation view
(through component diagram)not reveal any implementation details? –
Nival class diagram
. Component diagrams model implementation view by just showing the implemented software components. As noted in other answers it shows less detailed view of the same class, just how they are implemented as software components. –
Richardson customer.java
and order.java
.It does not reveal any coding details, Somewhere it may and should contain interfaces()
, but overall you can say it shows an abstract form of implementation.So, in short I tried my best to explain it to you, showing examples for a complete system would take so much space and would not count as a very good answer on this platform.If you wanna look for a more detailed diagram you can look it HERE --uml-diagrams.org/component-diagrams-examples.html –
Richardson In UML component can do the same thing as class diagrams.
But the main difference is that components have bigger responsibilities than class
Kruchten developed the 4+1 view model to capture different parts of the system.Simply put,it helps you model different views(logical,physical,devlopment,process,use case) of the system
Each view captures a specific aspect of the system
Logical view describes what a system is made up of and how the parts interact
Implementation view also known as Developement view describes how system's parts are organized into modules and components
Habitually it can be seen as a more detailed diagram. The class diagram should have properties defined with implementation specific types such as.
Box
- cats: list<Cat>
+ getCat: Cat
+ addCat: void
The component is a less detailed view of the same thing. I don't remember how much detail is visible. As far as I remember, it could be the same thing as the class diagram without types.
The component diagram should be used to design the general idea of what you're trying to build. The class diagram could differ having more classes because the implementation requires classes that don't have to be present using the component diagram.
My words have to be taken with a grain of salt because I admittedly didn't draw diagrams for a while.
A class model is the base for the component model:
Software designers first design the logical structure specifying logical elements ("Classes"), their responsibilities ("Methods"), structure ("Properties") and relationships to other classes (Generalization, association etc.), regardless (at some extent) of the technology that will be used. This is the Class model
Based on the class model, Software engineers specify the pieces of software ("Components") what they will write or otherwise purchase and the connections between them (integrations, depedencies etc.) in order to realize the designed Class model. This is the Component model.
The Deployment model then depicts where the Components will be deployed on the hardware or virtual hardware.
© 2022 - 2024 — McMap. All rights reserved.