1

How do I show the relation between a class named ApiService with method named fetchDataFomAPI() and a class named Student.

Can I link them directly ? an aggregation between the two classes Student-(Fetch data)-→ApiService ?

If yes, what are the cardinalities here ?

2
  • @GeertBellekens the main difference is that the other question is about a parameter to an operation, whereas here it's about the return type as the api seems about fetching students. The answer is therefore similar but more specific regarding the kind of dependency. I took the opportunity to be more specific about why it's not an association, as the other answers made some claims which appear not specific enough for guiding someone with only superficial knowledge of uml. Commented Feb 25 at 19:18
  • @Christophe the return type is also a parameter. I don't see enough difference to make it a separate question. And there is probably one about the return type as well if you search for it. Commented Feb 26 at 6:41

1 Answer 1

0

The relation between the ApiService instance and the Student objects (that it returns when the operation fetchDataFromApi is called) is spurious: it exists only for the time of the operation. I would not expect the ApiService to keep track of all the students it has returned nor the students keep track of the ApiService that created it.

As a consequence the relation should not be an association (nor a shared aggregation, nor a composite aggregation).

The relationship would be a usage dependency (an open headed dashed arrow from ApiService to Student with or without «use»), probably even more specifically a «create» dependency. And no multiplicities ("cardinalities" in non-uml ERD-speak ) are needed for dependencies.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.