Can I improve my design on these 2 diagrams below? If so, how?
I am confused by the use of association classes in my diagrams. Should I use them?
Figure 1
Figure 2
For association classes, they make sense only if they represent associations with some behaviour and state. Look at Article'sSubject. It has nothing more than source, target and identity. You don't need a class for such a association, just use plain association, which has all those properties. There are more such unnecessary association classes in your diagrams. Another important thing when using association classes is that every instance of that association class should have unique source and target pair. For example Comment is not identifiable just by Article and User - one user may have man ycomments on one article and that is not allowed.
An association class is used to capture certain characteristics of an association between two classes. These characteristics do not belong to the classes being associated but instead belong to the relationship between the classes.
来源:https://stackoverflow.com/questions/4744466/when-to-use-uml-association-classes