(I’m trying to phrase this question to be as specific as it can get, but since I’m mostly interested in high-level design it might be a bit still too vague. Let me know if I need to edit it or specify it any further!)
I have recently made a customised pattern for data sharing in Swift, and I’m looking for ways to validate my solution and improve it further.
What techniques are used to verify the design of a customised programming pattern? Apart from memory management, thread safety, and access control, what are some other important aspects which I should consider when I first implement it?
In my specific case: The idea combines singletons and mediators to share data between different parts of the app. This would allow the developers to easily access the same content in different parts of the software. (And can also work as a cache between different UI elements of an application.)
I have specified the solution as a class with the following properties:
- It can be specialised with any give type.
- Creates a shared instance on the first access.
- It contains a public optional property with the given type, which holds the data we want to share.
- Exposes a function which other objects can use to subscribe and unsubscribe for notifications about the data modification.
- Sends a multicast notification to the subscribers when the data is modified.
You can find the work-in-progress implementation (in Swift) here: https://github.com/endanke/Observator
My question in context of the example: What are the main aspects that determine if this specific class is ready to be used in a production environment? I have tested it in a small scale software and although it works as intended, I would like to rule out some possible design issues that I might not considered yet.