BHoM / BHoM_Adapter

GNU Lesser General Public License v3.0
7 stars 6 forks source link

Move all logic inside Adapter Action UI components to the Adapter #259

Closed alelom closed 3 years ago

alelom commented 4 years ago

Broken rules:

In the Push, the Pull and all other Adapter Actions components there is some logic that has been implemented inside the UI. This logic resides in the PushCaller, PullCaller, etc. classes, and it has always been "improper". The reason behind this is that we had to ensure that some setup was always done prior to calling the action method. In particular:

Suggestions to restore compliance

Instead we can consider the following. Taking the example for the Push action, we can have the UI PushCaller to call another method: something like SetupThenCallPush(). This method can be defined in the Base Adapter to include any needed setup; then it will simply return a call to the normal Push(). The same can be done for all actions.

The advantage of doing this is that the SetupThenCallPush() will be able to do any automatic casting / input transformations before the actual Push is called, without having to affect any Toolkit that uses or overrides the default Push.
We can make it overridable too, so if some of the setups are not useful for a particular Toolkit, or if some messages have to be returned prior to certain setups, we can do it.

@al-fisher @IsakNaslundBh