Recently while working with one of our clients we have stumbled upon a problem which we were not sure how to code in a meaningful way. We worked on a monitoring application for electronic devices with a dashboard showing statuses, alerts and different statistics around health of the monitored devices.
The application is sold for different companies in Europe to help them manage their electronic devices portfolio and is commercially pretty successful.
While working on the application our client asked us to integrate with one of the cloud based solutions for authentication and authorisation that they used company wide as a standard.
One user story we had to deliver involved some manipulations on all accounts owned by a company that uses the monitoring app for managing their electronic devices. Putting aside functional details, the trouble was the authorisation & authentication solution we were asked to use could not return all accounts of a particular customer due to the company field in this component could not be indexed.
Unfortunately, we could neither easily pull all accounts in one call to the authentication and authorisation component to filter them out programmatically because of a pretty high number of records and the limit on records that can be pulled.
Instead, we misused an existing, indexed field called USERS_MIDDLE_NAME to store company name and encapsulated our hack like solution in a thin anti-corruption layer.
Afterwards we meet, as we have a habit to review our work done altogether, and realized that it’s not an easy task to model in code such a hack in an expressive way. We discarded quickly an option of using a comment as we in general think that a comment in code feels like a manual instruction of how to push a button to summon a lift (in other words the code and the button should be self-documenting).
In some more general terms we are talking about the following situation – called here a “hack problem”:
a) you have an application which is related to an outside service based on a conformist relation (for the conformist relation description please see for example here https://culttt.com/2014/11/26/strategies-integrating-bounded-contexts/ ) – so to put it simply, you can’t influence functionalities at the other side
b) the service cannot provide you with all functionalities that satisfy your needs so for some work you need to use a hack (like we used by abusing an indexed field to store a company name)
I can imagine there might be no general answers but it might exist several classes of hacks and different way to model them properly in code.
You challenge is to propose a model for “a hack problem” that will solve our field abuse problem described above together with another two classes of hacks of your own choice (the harder ones the better).