Architecture Tactics ‐ Availability - SENG-350-2024-fall/Team-8 GitHub Wiki
Architecture Tactics - Availability
Exception handling
-
Manifestation in Design: There are a lot of places where errors are handled within our project. For example, when getting the next ticket for a triage, our code uses an API to communicate with an external queue system. If the queue cannot be accessed, whether because it is down or the fetch call fails, it will throw an error. So, within the nurse triage code, any time the queue is accessed, there is a try/catch block around it to handle this situation. If the error is caught, we tell the user that their request has failed and to try again. As a part of the error handling, any code logic that assumes the request succeeded is skipped to prevent further errors from being thrown.
-
Testing Quality Attribute: Unit tests can help detect whether our code handles errors correctly. By mocking an error response from places that are expected to throw errors, we can test that our classes handle them correctly and return a suitable output.
Exception detection
-
Manifestation in Design: One example of exception detection tactic used in this milestone came with debugging the database client which updates the availability state of the EMTs. The new database client was successfully making EMTs enter available state on login, but failing to place them in unavailable state on logout. In order to find the source of the bug, we forced the handling function to wait for the response from the database and output it. This allowed us to find the exception/error being thrown and fix the bug. We were missing a key piece of data in local storage (user id), which would always result in a 404 error. This issue was resolved and the system works as intended.
-
Testing Quality Attribute: Looking for error responses and exceptions like the example above is good practice when trying to find the source of a bug or just throughout code as it is being built. It is impossible to foresee every possible exception but it is good to check areas that are suspect.
Timestamp
-
Manifestation in Design: Timestamp is manifested in our design through the use of logs. The code contains a logging function that records errors and events during operation such as when creating new accounts. Each log entry contains information regarding errors, warnings and other messages as well as the time it was generated.
-
Testing Quality Attribute: The timestamps are tested by performing a series of actions during system usage and making sure that a correct log entry is generated when required.
Sanity Checking
-
Manifestation in Design: Sanity checking is implemented throughout our system in various user input scenarios, such as creating an account, logging in, and requesting a triage. Each time user input is required, we perform basic checks to ensure that inputs are not null and contain valid values. These checks help verify that essential conditions are met before proceeding with further processing, thereby allowing us to maintain operational flow and enhance overall stability.
-
Testing Quality Attribute: Sanity checking is tested by performing unit tests to test scenarios where the user inputs are null or in an invalid format.
Exception prevention
-
Manifestation in Design: Exception prevention is utilized in several areas of our design, particularly in user input scenarios. For instance, in our account creation functionality, we implement a chain of responsibility validation checker to verify that all required information is complete and meets our predefined criteria. This validation process ensures that no accounts are created with incomplete or invalid information, which ultimatly minimizes potential errors that users may encounter.
-
Testing Quality Attribute: The exception prevention is tested by doing manual testing on the user inputs to make sure that the constraints were properly defined.