I had to develop an application in Java for a school project, so I designed a UML class diagram oriented towards Java (including structures, attributes and types). For example:
-getLists() : List<String>
So the question is: should I assume which language I'll be using when creating a UML class diagram or should I take a more generic approach?
2 Answers 2
A rule of thumb is that the UML model should be technology independent. Having said that I would add that sometimes you use some constructs which might be more related to a specific technology (like multiinheritance).
In your case instead of
-getLists() : List<String>
use multiplicity:
-getLists() : String[*]
to indicate a collection of Strings. This is UML compliant.
If you know the language that will be used, I don't think it can hurt to use the naming conventions, notation, and so on of the language. It will save time when it comes time to code, and it can help you work out the exact contracts of your interface.