1

I'm trying to build a state diagram derived from the class diagram for the Support Manager Class.

Here is the class diagram (reputation <10 so can only provide link):

http://i.imgur.com/3wFO9Gu.png

This is the state diagram that I have constructed so far: http://i.imgur.com/vBTyTLX.png

I'm not sure if this is correct. But the state diagram should represent the Manager class and the manager class is supposed to:

  • Allocate 'resource' to employees
  • Be able to update the resource to employees
  • View the outstanding job for an employee
  • allocate a technician to a job
  • update the system information
  • notify employee that the job has been complete - (technician fixes problem and the job is confirmed by manager).

Is this possible to represent on one state diagram? Or would this require several? Is the diagram correct in the representation of how the manager deals with a resource problem raised by an employee?

user3507121
  • 79
  • 1
  • 10

3 Answers3

0

for me what you want to represent seem to be an Activity diagram more than a State diagram because, for me, you describe more a working process than states.

It should be feasible to represent your behavior in one unique diagram (if it is still comprehensible).
You are the only which cant tell if your representation is fine, but maybe could you add link (call) to your method!?

Red Beard
  • 3,436
  • 1
  • 14
  • 17
  • that's also what I was thinking, seems to be more of an activity than state... but the question specifically specifies and asks for a state diagram (derived from one of the classes). Maybe might be better if I drew a state diagram representing the Outstanding Problems class - which may be easier to draw up states for – user3507121 Apr 14 '14 at 08:00
  • What is the specific question? – Red Beard Apr 14 '14 at 11:01
  • "Draw A state Diagram for one of the main classes. Choose a class that has at least three states" – user3507121 Apr 14 '14 at 11:05
  • And from where come your class diagram? is it also the result of a question? If yes which question? – Red Beard Apr 14 '14 at 12:14
  • In fact I would try to find in the problem description an 'object' which can have at least three states. In this way you will be able to define your state diagram. Good luck with your exam!! – Red Beard Apr 14 '14 at 13:13
  • Thank you for your reply and your help... Thanks, I feel pretty confident about it except for this state diagram! Back to the drawing board! – user3507121 Apr 14 '14 at 13:50
0

The state diagram is definitelly not the adequate tool to show Manager's activity. The reasons are many, I'll give you just one - Manager can have several "threads" of the "workflow" represented by this state diagram - one job can be in the "pending" state, another in "confirmation", etc.

Therefore this workflow would rather define the class "Job", than the Manager. You could review the multiplications on this class, as not all liks are established on the Job class creation.

The responsabilities of the Manager (that you listed) could be modelled by methods on the class and their sequenceby an activity diagram.

Aleks
  • 5,674
  • 1
  • 28
  • 54
  • Thank you for clarifying this up for me. Being a novice I wasn't sure if i was missing a trick but it does make sense (explains why I was finding it extremely difficult!). I have created a quick draft of a state diagram for the Job class http://i.imgur.com/lyLLxP6.png Is this more correct? Thanks again for your reply. You've been extremely helpful! – user3507121 Apr 14 '14 at 10:27
  • @Gangnus thank you for your reply. I'm supposed to show the state of a class (any class). Due to the size of the manager class, I thought it would be ideal to show how it switched through various states... However, turns out state diagram to demonstrate the whole class is not applicable. Or is there a way to demonstrate the state of the manager class? – user3507121 Apr 14 '14 at 10:31
  • @user3507121 Notice, in your question you have defined different actions. You can't make a state machine out of it. Try to think in terms of states and events – Gangnus Apr 14 '14 at 12:50
  • @user3507121 this look much more sound, although now you possibly mixed up the state machnes for Job and Resource. A couple of observations... Consider making two different end states to indicate crutially different "destinies" of an object (IRREPARABLE and COMPLETE). Further observationsare only regrding the style/naming. State names should be shorter and and passive formed: "new job" -> CREATED, IN REPAIR, etc. Also name transitions (actions performed over objects). I suspect the sae transition leads out of IN REPAIR state, with two different outcomes (repaired and irrepairable). – Aleks Apr 14 '14 at 20:53
  • @Aleks thanks for your reply. I have created a new state diagram based on your feedback and added a few other points. Does this correctly represent the states? http://i.imgur.com/rznQEkY.png?1 – user3507121 Apr 15 '14 at 08:34
  • @Aleks thank you so much for your help! So to confirm this is a state diagram? I found it so confusing before.. looks like I learnt a valuable lesson - don't mix activities and states! – user3507121 Apr 15 '14 at 13:27
  • Activities and states tend to be kind of complementary. Transitions between states are good ccandidates for activities in activity diagrams. States themselves are often assigned to objects, as they are manipulated by acttivities. States are "stable" conditions, activities are dynamic. State machines are assigned to classes or components, activity diagrams can span as widely as over lots of collaborating components (business level) or be as low-level as specification of a method in a class. Good luck! – Aleks Apr 15 '14 at 19:54
0
  • You can't derive state diagram from a class diagram. For behaviour is not defined by structure.
  • But you can create a state diagram for explanation in addition to a class diagram.
  • Principally your state diagram is OK. But:
    • you have obvious errors in its lower part - you are doubling the choice confirm/reject there.
    • It is a STATE diagram? Where are states? You have mixed actions (arrows) and states (rounded rectangles) so, that you have only actions. If you want to describe actions instead of states, you really need activity diagram.
  • You can create a state diagram for modelling Manager behaviour. But it has sense only if you are thinking of it in terms of states and events/actions.
Gangnus
  • 24,044
  • 16
  • 90
  • 149
  • Thank you for your reply. I will try and re-design the class manager state diagram. Would you mind taking another look at the NEW diagram once I've made it? Thanks again for your help. – user3507121 Apr 14 '14 at 10:50
  • @user3507121 Of course. But put here a comment after editing, for else I won't be notified about the changes. – Gangnus Apr 14 '14 at 12:48
  • This is my v2 that I've come up with... http://i.imgur.com/AirY65l.png - To me it still feels like an activity diagram... Is this any better? – user3507121 Apr 14 '14 at 13:48
  • @user3507121 yes. It is a correct Activity diagram. And it is useful - a problem is seen at once - no mechanism for breaking the cycle is proposed. – Gangnus Apr 14 '14 at 15:12
  • Would this diagram be seen as a state diagram? I've added the breaking the cycle mechanism (which I think is correct) http://i.imgur.com/QENpwdl.png I really appreciate your help, so thanks again @Gangnus – user3507121 Apr 14 '14 at 18:58
  • @user3507121 1. No, it is Activity diagram, not a state machine. download the standard http://www.omg.org/spec/UML/2.5/Beta2/ and look for state machines examples there. 2. As for cycle breaking, it is OK. 3. Have a +1 for the question, and welcome to SO. – Gangnus Apr 15 '14 at 07:53
  • @user3507121 and please, put @... addressing at start of the comment - then the adressee will be notified. – Gangnus Apr 15 '14 at 07:54
  • -@Gangnus thank you for your reply and help. I will read the doc and hopefully the examples will help me create the state diagram! Thanks again for all your help :) P.S (every time I try and '@' it doesn't give me your name and if I didn't add the '-' it wouldn't display at all. Am I doing something wrong?) – user3507121 Apr 15 '14 at 08:05
  • @user3507121 you are welcome. As for @..., I sometimes have same problems with it, too. Maybe it is due to browser or its version? I use FF and Chrome. But -@ simply won't notify anybody. – Gangnus Apr 15 '14 at 08:17
  • thanks I will keep this in mind. Just tried it on Chrome, FF and IE and all three didn't seem to work. Maybe is a plugin interfering with it or so. Anyway, I've taken up enough of your time! Thanks again :)! – user3507121 Apr 15 '14 at 08:28