uc 15 v2 - yshehab/SchoolRoomBooking GitHub Wiki

15. Add a new organization. Version 2

TO DO - revise

Coordinating method

public void addOrganization(String name, 
                            Address address, 
                            Member aMember)

Object diagram for a typical scenario.

Walk-through for this scenario

Given: the Address object address4, the name "Bagpipe Band" and the Member object member1

  1. The UI attempts to create a new Address object with entered attributes
    As this suceeds:
  2. A new Address object address4 is created with the supplied attributes: As this is a new Address there will be no Organization with the same name linked to it.
  3. The UI sends the coordinating message with name "Bagpipe Band", Address address4 and Member member1 as parameters
  4. Check that an organization with name "Bagpipe Band" doesn_t exist linked to address4 (this check is not needed for this scenario , but is for the alternative scenario)
    As it doesn_t:
  5. Create a new Organization object organization3 with the name "Bagpipe Band"
  6. organization3 records a reference to address4
  7. organization3 records a reference to member1
  8. letting records a reference to organization3

Object diagram for the alternative scenario - the Address already exists.

Walk-through for alternative scenario - the Address already exists.

Given: the Address object address9, the name "Yoga" and Member object member2

  1. The UI sends the coordinating message with the name "Yoga" , Address address9 and Member member2 as parameters
  2. Check if an organization with name "Yoga" exists linked to address9
    As it doesn_t:
  3. Create a new Organization object organization7 with name "Yoga" and address address9
  4. organization7 records a reference to member2
  5. letting records a reference to organization7

Sequence diagram for the typical scenario

Notes on alternative scenarios

If an Organization object with the same name is linked to the Address object throw an exception.
Note: as Address class doesn_t have (and shouldn_t have?) a Set<Organization> attribute, the check for organizations with supplied name attribute value existing linked to the supplied address will need to be done by checking all organizations in letting and if they have a matching name check if they are linked to the supplied address.

Updates to implementation model

Classes

Class Organization

Links

None

Methods
public Organization createNewOrganization(String name, Address address, Member aMember)

Postconditions: a new Organozation object anOrganization is created with the supplied attributes. A reference to anOrganization is returned.

Class LettingCoord

Links

None

Methods
public void addOrganization(String name, Address address, Member aMember)

Class Address

Links

None

Methods

None

Navigations

None

Discussion

15. Add a new organization (Superseded version below - changed 9.11.13)

Coordinating method

public void addOrganization(String name, 
                            Address address, 
                            Member aMember)

Object diagram for a typical scenario.

Walk-through for this scenario

Given: All the attributes required to create a new Address object and the name "Bagpipe Band"

  1. The UI attempts to create a new Address object with entered attributes
    As this suceeds:
  2. A new Address object address4 is created with the supplied attributes: As this is a new Address there will be no Organization with the same name linked to it.
  3. The UI sends the coordinating message with name "Bagpipe Band" and Address address4 as parameters
  4. Check if an organization with name "Bagpipe Band" exists linked to address4 (this check is not needed for this scenario , but is for the alternative scenario)
    As it doesn_t:
  5. Create a new Organization object organization3 with the name "Bagpipe Band" and address address4
  6. letting records a reference to organization3

Object diagram for the alternative scenario - the Address already exists.

Walk-through for alternative scenario - the Address already exists.

Given: All the attributes required for creating a new Address and the name "Yoga"

  1. The UI attempts to create a new Address object with supplied attributes
    As this fails:
  2. The Address object address9 is returned with the same attribute vales as supplied
  3. The UI sends the coordinating message with the name "Yoga" and Address address9 as parameters
  4. Check if an organization with name "Yoga" exists linked to address9
    As it doesn_t:
  5. Create a new Organization object organization7 with name "Yoga" and address address9
  6. letting records a reference to organization7

Sequence diagram for the typical scenario

/images/use_case_15_sequence_diagram.jpg

Notes on alternative scenarios

If an Organization object with the same name is linked to the Address object throw an exception.
Note: as Address class doesn_t have (and shouldn_t have?) a Set<Organization> attribute, the check for organizations with supplied name attribute value existing linked to the supplied address will need to be done by checking all organizations in letting and if they have a matching name check if they are linked to the supplied address.

Updates to implementation model

Classes

Class Organization

Links

None

Methods

needs a factory method??

public Organization createNewOrganization(String name, Address address)

Class LettingCoord

Links

None

Methods
public void addOrganization(String name, Address address)

Class Address

Links

None

Methods

None

Navigations

None

Discussion

It seems a little bit awkward and error prone for the GUI to pass so many arguments to the coordinating class. If the GUI could use a builder to create an Address object and then pass that to the coordinating method, it would be much cleaner. Thoughts? -Damien

Yes, I agree. I have changed the walkthroughs and added a new sequence diagram - Ben

⚠️ **GitHub.com Fallback** ⚠️