Page SoftwaretechnikProjektAgil2012SprintBacklogsSprint2Session6Spec

Session-6 Spec

Requirements

  • A user can choose between 5 colors, which are defined in the plugin.xml file.

  • A default color is chosen at randomn. The User can change it, if he likes.

  • When a session is started, Saros tries to give each user his preferred color.

  • If there are collisions, Saros uses a mechanism to resolve it without bothering the users.

  • If the same users with the same color preferences are in a session, the color assignment should remain the same. This should be independent of the sequence in which the peers enter the session, and independent of who is host of the session.

  • During a session a user can change his session color and his preferred color. For the session color only available colors can be chosen, for the preferred color any of the 5 colors can be chosen.

Approach

For each constellation of users taking part in a session the assigned colors are saved in ColorIdSets, which are persistently stored within the PreferenceStore. Whenever a session is started or a new member is invited, the host (or the inviter) checks whether he finds a ColorIdSet that fits to the group of participating users.

He then sends the specific colorId together with the invitation to the client. The client accepts sending his favorite color back to the host. The host now does some optimizing, trying to satisfy all participants’ color wishes. If a change to a favorite color is not creating any conflicts concerning duplicate favorite colors or already assigned colors in the chosen ColorIdSet, the ColorIdSet is updated. So the favorite color overwrites color assignments if there is no need to stick to non-favorite colors. The final colorIds are sent to all participants, who save the sets on their part in their local PreferenceStore.

Changing a session color during a session provokes a ChangeColorActivity which leads to an update of the current ColorIdSet.

The optimization process takes into account:
  1. the users’ favorite colors
  2. a fitting colorIdSet of a former session
  3. already assigned colors should remain the same even if an additional user joins the session and the newly emerging session constellation had different colors assignments for the users in a former session.
  4. If a color conflict evolves, the next available color will be assigned to one of the users (FCFS). E.g. A and B have the same favorite color. A is host and therefore gets his wish, B gets the next free color out of the pool of available colors, which is defined in the plugin.xml file.

Use cases

In all use cases the favorite color of all users is brown if not differently specified.

Use case A - Keeping former colorIdSets:

A firstly starts a session with B. Later on C joins.

A gets brown, B gets green, which is the next free color. C gets yellow, as it is the next free color after brown and green.

In the next session, in which B is host, B invites A and C (by multiple invitation). The same colors are reassigned.

In the next session A is only working together with B. A gets brown again and B green as in the former session.

In the next session C invites only B. These two have only worked together with A before, so there is only a colorIdSet with three members but none with only B and C. As we cannot predict that A will join the session later on, a new colorIdSet is created: C as host gets his favorite color - brown, B gets green, as it is the next free color starting from brown in the available colors pool.

Now A invites B and C by multiple invitation again, and the triple colorIdSet from the first session is reassigned: A: brown, B: green, C: yellow.

Use case B - User changes session color, taking into account that his favorite color is not used at all:

A: brown, B: green, C: yellow are working together in a session. For some reason A decides to use blue during this session.

A invites B and C once more by multiple invitation and receives brown again, although the latest colorIdSet provided blue for him, as it still is his favorite color which can be taken.

Use case C - Same as use case B, but another user starts the next session:

A: brown, B: green, C: yellow are working together in a session. For some reason A decides to use blue during this session.

B invites A and C once more by multiple invitation. B uses the ColorIDSet saved last, but notices during the invitation process, that his favorite color brown is not assigned to any user. So his color is set to brown. The conflict evolves, when A accepts the invitation, sending brown as favorite color. As this cannot be satisfied, A sticks to blue, and C to yellow.

Use case D - User, who had not his favorite color, changes session color:

A: brown, B: green, C: yellow are working together in a session. For some reason B decides to use blue during this session.

A invites B and C once more by multiple invitation. A and C stick to their former colors brown and yellow. B gets blue instead as he chose blue last time.

Use case E - User changes favorite color liberating another user’s favorite color:

A: brown, B: green, C: yellow are working together in a session. A doesn’t like brown anymore and sets his favorite color to blue instead. So far there are no impacts on the current session colors.

But next time A invites B and C again. As there is no reason why A should not get his favorite color (blue is not used in the triple ColorIdSet), he gets blue, which leads to the fact, that brown is available again. Now it depends on whether B or C, who still have brown as favorite color, is the first one who sends is invitation accept. If B is the first one, he will get brown now, C will stick to yellow.

If C is the first one C gets brown, B will keep green from the last session.

Use case F - Different colorIdSet when new user joins:

A: brown, B: green, C: yellow have been working in a session.

In the next session C invites only B. C gets brown, B gets green.

Now A joins the session. This means that the colorIdSet which contains all three members should be used. But as we don’t want the colors of already connected participants to be changed, B and C keep their colors brown and green. A gets the next available color, which is in this case yellow. So A and C have swapped their colors. The colorIdSet is updated. In the next multiple session of A, B and C this newly defined colorIdSet will be used, no matter who of them is the host.