I'm designing an online music website where there are two main objects: User and Music. There are many operations users can do to music,like they can upload,listen to, collect,share and download a music. If I draw an UML class diagram, the diagram would look like
this:
So my question is that is it OK with so many associations?
-
1You should probably get a book and read some basics about UML. Your approach indicates that you did not understand them.qwerty_so– qwerty_so2016年04月23日 17:03:23 +00:00Commented Apr 23, 2016 at 17:03
-
Welcome to StackOverflow, @Ivan. If you found an answer to your question, please consider accepting it (by clicking the check-mark), and consider up-voting it (by clicking the up arrow). Accepting an answer indicates to the wider community that you've found a solution, gives yourself some reputation points, and gives some reputation points to the person who answered your question. If you did not find a satisfactory answer to your question, please leave a comment.Jim L.– Jim L.2016年05月13日 02:34:28 +00:00Commented May 13, 2016 at 2:34
-
@JimL. Sorry for later response. I have been too busy to check for what's updated here recently.Ivan– Ivan2016年05月24日 12:47:57 +00:00Commented May 24, 2016 at 12:47
3 Answers 3
Those are not association, but methods which are to be defined in Music. You probably have just one association between both.
You might want to synthesize some use case cases first:
Based on this you can create a class model:
And detail this with behavioral design:
8 Comments
Having many associations between two classes is allowed by the UML standard. Strictly speaking, you should then add to each association role names to distinguish them when navigating from one class to the other.
5 Comments
0..* for example. You may have entered some of the cardinalities as association-end names by mistake.The model you have would be acceptable for a model of a problem domain. If this model is intended to be a model of the solution domain, you might have one association with operations representing available actions, or signals representing completed actions.
Since you use the class User, you are probably trying to model the solution domain, though. That suggests you should use operations or signals.
2 Comments
User to Music. User can then invoke operations on Music. If you had interacting state machines in User and Music, or if the objects ran on separate machines, you could send signals instead. Music could have what are called signal receptions, which look almost the same as operations. (Although I just noticed that listenTo() and collect() operations don't make sense as operations or signals. You seem to have something in a netherworld between an analysis model and a design model.)