I haven't understood well how to use port, connector and interfaces in a UML2 component Diagram.
I understand that a component can be a physical or a logical component, is the same with interfaces? For example a required import becomes a required interface in component diagram or a simple usage as in class diagram? And also I don't understand the concept of a port as an interaction point: is only a representation of enter and exit point in amicroservice?
To understand I've made two very typical scenarios in applications (I'm a java developer).
Scenario 1
A typical facade pattern where my client application needs to call several web services (rest or soap) through a facade.
I try to represent in a component diagram:
1b) Between Client and facade component is the use of interfaces correct or I only need a simple <>? Phisically ther's no interface, but only a class import, but logically even the facade component expose an API (different from web service API). Port is not needed because client and facade are not pieces of software totally indipendent, am I right?
1c) Between Facade and Services I need ports because we connect to various indipendent pieces of software (maybe not event our software). Is right?
Scenario 2 Now I made a second scenario also very typical in a java web application. An MVC application that need to call an EJB (a remote class with an interface) for business puroposes.
My component diagram:
2a) In this case a enclosed my userInterfaces in a presentation component a made a delegation connection between various UI and the entire component. Is this the right way to use it?
2b) Between presentation and business component is the same situation of scenario1 when a I call the web services and the use of the port is needed?
If my component diagrams are wrong, please help me understand my errors and how to make a correct component diagrams for those scenarios.
This is almost ok. Your
Delegate
class looks superfluous. Delegation is a more abstract concept:So you just draw a
<<delegate>>
relation from the port towards the class, component or property which inside the component will take responsibility. You can also delegate to internal interfaces as you did.I looked up UML 2.5 for delegation. On p.189:
There's more about ports around that page.