Hi can someone explain me a specific statement in ...
# android-architecture
l
Hi can someone explain me a specific statement in a blog post (it's about CQRS): https://blogs.cuttingedge.it/steven/posts/2011/meanwhile-on-the-command-side-of-my-architecture/ It's following part which I don't understand:
...all handlers define their own interface (there is no common interface). This makes it hard to extend the command handlers with new features and Cross-Cutting Concerns. For example, I would like to measure the time it takes to execute every command and log this information to the database. How can we do this?
...
All these problems can be solved elegantly by having all command handlers implement a single generic interface
How does the common interface solve the problem to implement time measuring?
not kotlin but kotlin colored 1
d
Read the whole article.
What does adding an interface give us? Well frankly, a lot! As nothing depends directly on any implementation but instead depends on an interface, you can now replace the original command handler with any class that implements the new interface. Ignoring—for now—the usual argument of testability, look at this generic class:
It allows for the use of the decorator pattern. But with less code because all commands inherit from a common interface.
What does this have to do with Android Architecture or Kotlin?