Sign up ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free.

I have some code, which I want to present in UML, but I've stuck at one point. Let me tell you something about code's functionality.

I have a workspace in which I can place some Components, select them, delete, add new, move etc. I can also connect them according to some rules (there are different types of Components available). In order to determine if a group of Components can be connected or not, I've implemented some easy mechanism. In this mechanism the following parts appear:

ConnectionRule - get the type of connection, and checks if a collection of Components given as a parameter can be connected according to this ConnectionRule.

ConnectionRulesSet - has many rules inside. Client asks a set with rules like this: "according to which rules definied in a set, components given as a parameter, can be connected"? ConnectionRulesSet gives a list of ConnectionRules as a response. A concrete Connection rules set are exposed only throug interface - Client cannot create an instance of a concrete RulesSet.

RulesSetFactory - depending on many circumstances, application can use different ConnectionRulesSets. That's why I've created a factory which gives a proper implemetation of ConnectionRulesSet interface depending on specified circumstances.

And now let's take a look at the Client's code:

// list of components which should be verified in terms of connection plausibility:
List<Component> selectedComponents = ... ;
// Get set of rules for normal conditions:
ConnectionRulesSet setOfRules = RulesSetFactory.getRulesSet(NORMAL_SET);
List<ConnectionRule> fulfilledRules = setOfRules.getFulfilledRules(final selectedComponents);
// Do something with fulfilled rules:
for(PlausibilityRule rule : fulfilledRules){
   addToAvailableRulesList(rule.getConnectionType().getName()); // display names of connetion types...

My problem is, that I'm not sure how to create an UML class diagram for such solution from Client's perspective... How to expose relationships between presented solution and a Client. Client uses actually all: ConnectionRule, RulesSet, RulesSetFactory...

There is one of my ideas below... What do you think? Have you got any better solution?

Sample UML class diagram

share|improve this question

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.