You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My goal is to wrap communication with a BLE device in a side-effects struct – a client in TCA speak. The communication involves logic with key exchange and responding to the device's state.
What would you (collective TCA community) do in my place?
a. Build a DeviceClient on top of ComposableCoreBluetooth
I like this idea because I can use familiar functional chaining on top of Peripherals and etc, instead of dealing with delegates and managing CBCentralManager instance et al. The biggest benefit would come from being able to mock CoreBluetooth responses.
b. Build a DeviceClient directly on top of CoreBluetooth
This would probably result in more maintainable client code, as CoreBluetooth changes slower than TCA and its conventions (affecting ComposableCoreBluetooth) and the client should have less code, compared to DeviceClient + ComposableCoreBluetooth.
c. Build a DeviceClient as proposed in a or b, and encapsulate key exchange/state logic in corresponding DeviceReducer
As I understand, clients should be simple enough as to not require unit tests to verify them. In the case of a "smart client" (a or b) it'll be not as easy to verify that logic, as in the case of having DeviceReducer.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
My goal is to wrap communication with a BLE device in a side-effects struct – a client in TCA speak. The communication involves logic with key exchange and responding to the device's state.
What would you (collective TCA community) do in my place?
a. Build a DeviceClient on top of ComposableCoreBluetooth
I like this idea because I can use familiar functional chaining on top of Peripherals and etc, instead of dealing with delegates and managing CBCentralManager instance et al. The biggest benefit would come from being able to mock CoreBluetooth responses.
b. Build a DeviceClient directly on top of CoreBluetooth
This would probably result in more maintainable client code, as CoreBluetooth changes slower than TCA and its conventions (affecting ComposableCoreBluetooth) and the client should have less code, compared to DeviceClient + ComposableCoreBluetooth.
c. Build a DeviceClient as proposed in a or b, and encapsulate key exchange/state logic in corresponding DeviceReducer
As I understand, clients should be simple enough as to not require unit tests to verify them. In the case of a "smart client" (a or b) it'll be not as easy to verify that logic, as in the case of having DeviceReducer.
d. Your suggestion?
Beta Was this translation helpful? Give feedback.
All reactions