1

I am developing an Android application trying to comply with Uncle Bob's clean architecture.

User interface has a text and a button. Button triggers a usecase (TextToSpeechUseCase) from viewmodel.

TextToSpeechUseCase uses a service/manager interface like "ITtsService" which is implemented in Frameworks & Drivers layer using Android framework dependencies.

So I need your help in two points

  1. Is my approach correct?
  2. Instead, should I implement the ITtsService in Interface Adapters layer then create another ITtsServiceSource interface within interface adapters layer, then implement the ITtsServiceSource within Frameworks&Drivers layer by using android framework dependencies?

1 Answer 1

2

I believe 2 is more in keeping with the Clean Architecture, Onion, Ports and Adapters, Hexagonal philosophy. This does leave your use case code feeling fairly brainless. String comes in, string goes out. Yawn.

But that's fine. Imagine the boss suddenly wants a version that suppresses swear words for the kiddies. Now you have some actual business logic. And it needs a place to live.

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.