It is often said about how to develop code in order to avoid the need to make throws, and how to find yourself in the role of a throw may seem like a better implementation. I am trying to achieve this holy grail of โfaceless codeโ in the implementation of a virtual world engine, where many objects have a wide range of interfaces, acting as intermediaries and data (and sometimes so) as from two different forms. As one answer is mentioned in a similar question ( Linkage ), the goal is to always have the link / pointer of the correct type in the right place, and not try to dig out one of the large number of candidate objects.
My last blow to managing this big problem involves registering objects with their intermediaries, which have some advantages in terms of granularity of control (you can adjust from time to time to the many comparisons between mediators and their goals).
There are some problems ... The biggest thing I'm looking at right now is de-registering targets from intermediaries. To track who uses what without polling all possible intermediaries, the program must store even more data about which links were created. On the one hand, mediators could turn themselves off by simply checking if their goals were expired (I use smart pointers and weak pointers for everything, so it's not difficult), however it just handles the expiration of objects and makes them not set a framework for meaningful reconfiguration of behavior.
When viewed from afar, this is just another case where the software boils to a compromise between time and memory. Store more data to do less computing.
, , , /, .