Skip to content

Instantly share code, notes, and snippets.

@scottroemeschke
Last active January 9, 2018 01:08
Show Gist options
  • Save scottroemeschke/fbffc52401f3434e34f9aba5193047d6 to your computer and use it in GitHub Desktop.
Save scottroemeschke/fbffc52401f3434e34f9aba5193047d6 to your computer and use it in GitHub Desktop.
//bad
interface ShoppingCart {
fun observe(): Observable<ShoppingCart>
fun setShoppingCart(cart: ShoppingCart)
}
//good
interface ShoppingCart {
fun observe(): Observable<ShoppingCart>
//these all update the public state, and return results (failures, successes, relevant info)
fun clearAllProducts(): ClearProductsResult
fun addProduct(): AddProductResult
fun removeAllProductsOfCategory(category: String): ProductsRemovedResult
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment