0

I'm trying to work myself into the Clean Architecture by Bob Martin with respect to android applications. It seems to me like there are Use Cases which do not encapsulate the Domain Layer, but belong to the most outer, peripheral layer. For example: "Open Image", "Take Picture", "Turn on Wifi". Where to put them? In the View, Presenter or something else? I've come up with a term PeripheralUseCase, and PeripheralInteractor, but still have my doubts.

2
  • Why do you believe those cases deserve special treatment? Commented Apr 12, 2016 at 22:47
  • They have dependencies in the peripheral (android) layer. They are not clean domain use cases, but got somehow dirty through their dependencies.
    – krzysiek
    Commented Apr 12, 2016 at 23:02

1 Answer 1

0

These are not peripheral, these are standard use cases. They have ports/layers/etc that talk to the actual device controllers.

https://blog.8thlight.com/uncle-bob/2012/08/13/the-clean-architecture.html actually calls this out fairly well. The device APIs are no different from a Database API. You call it the same way, encapsulating it just like you would a database call.

This allows you to do things like simulate this call, keep it independent of your code, and port your application to a totally different platform with different APIs.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.