What is the purpose of the ProviderConsumer method. If its a testing tool, wouldn’t it make more sense to make that a static class? I don’t think I understand the purpose of insatanciating a ProviderConsumerObject? From what I understand, this would allow a providerConsumer to instantiate a ProviderConsumer object, but isn’t that the purpose of the “new” key word?

Staying healthy

Some people use fitness gyms to maintain and improve their health. A gym can have multiple locations in cities. Individuals may choose to go to any gym located in different cities. Assume a person can make one or more reservations to use any of three exercise facilities: cardio, swimming, and yoga. A gym can disseminate information about the availability of its exercise facilities at three locations: Mesa, Phoenix, and Tempe. Exercise facilities are available during specific time slots, such as 7:00 to 9:00 or 14:00 to 16:00 (i.e., time slots are in 24-hour clock format). Assume time slots can be within a 24-hour day.

Software systems can be used to “connect” gyms (providers) and people (consumers). Gyms (e.g.,

Planet Fitness, LA Fitness, 24 Hour Fitness) can inform any consumer (such as James, Mary, or Robert) who might be interested in using their facilities. Considering the publisher-subscriber design pattern, gyms can be considered as publishers and people as subscribers. Individuals may subscribe to any kind of exercise facility and gyms notify the availability of each exercise facility. Individuals can stop receiving notifications by unsubscribing.

 

Scope

Develop a publisher-subscriber software system. This system should support three types of events named “publish”, “subscribe”, and “unsubscribe”. Each published event includes a gym (i.e., publisher) such as Planet Fitness,  exercise facility such as swimming, facility location such a Tempe, and available time slots such as 11:30 to 12:30. Each subscribed event includes an individual and an exercise facility in which the individual is interested. Similarly, an unsubscribed event includes an individual and an exercise facility. The time slots should be in a 24-hour format .

When a fitness gym publishes its locations, exercise facilities and timings, all subscribers who are currently subscribed to exercise facilities will receive notifications. A notification would be one or more lines of output (see the Coding and Testing section).

The subscribe, unsubscribe, and publish events are to be processed sequentially. A subscriber will not receive notifications for a given exercise facility unless s/he has subscribed to it. Once a subscriber unsubscribes from an exercise facility, s/he will no longer receive notifications unless it is resubscribed. Multiple subscribers to an exercise facility are notified according to the order of their subscriptions; this is required to have a fixed order of output events. The syntax for the publishers and subscribers is:

 

  • publish, [publisher], [exercise facility], [gym location], [gym timings]
  • subscribe, [subscriber], [exercise facility ]
  • unsubscribe, [subscriber], [exercise facility ]

 

The names for publisher, subscriber, facility categories, and available locations may contain any character except comma and leading/trailing spaces. The software should treat upper-case and lowercase names to be the same (e.g., “Swimming Pool ” and “swimming Pool” are handled the same).

Your program should not produce any output other than those expected. Therefore, please do not include welcome messages or other extraneous information. Additionally, the program should not produce any error messages during the entire execution. An example is when a subscriber is trying to unsubscribe from a category s/he has not subscribed to. Duplicate subscriptions should be ignored. There are no error messages if a consumer subscribes multiple times to a category.

 

Analysis and Design Artifacts

The design for the software system must follow the publisher-subscriber design pattern. This pattern has a broker to manage the operations of the publishers and subscribers while ensuring they do not have any direct relationship (access) to one another. Every publisher is independent of all other publishers just as every subscriber is independent of all other subscribers. This means that both the structure of your system and the behavior of the components of the software system match the publisher-subscriber design pattern.

You need to develop UML specifications using the Astah tool prior to implementing them. You should include an appropriate number of class, use-case, and sequence diagrams and one state machine diagram for the broker. The design should have documentation.

The providers should implement the IPublisher interface shown in Figure 1. Similarly, the buyers should implement ISubscriber, as in Figure 2. You may implement additional methods, but they will not be used in the testing process.

 

project description