Created
April 2, 2020 08:07
-
-
Save victornoel/ffcefba162028beb6f95f8e08d746d13 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Book book = new Book( | |
"How to Ruin Everything: Essays", | |
"Watsky, George" | |
) | |
// it has multiple methods related to reviews, | |
// the interface is not related to books in particular, | |
// it's part of our domain | |
Review reviews = new BookReviews(book) | |
// a ReviewGrading has one method that take a review and rate it, | |
// there can be many implementation of this grade computation, | |
// depending on the need, MedianGrading(), etc... | |
// its responsibility is to generate rates for reviews | |
// that are meaningful to humans that have to choose if | |
// they want to read a book or not | |
ReviewGrading grading = new SuccessCoefficientGrading() | |
// it implements something like cactoos' Text, | |
// or maybe there could be a more domain specific interface if needed | |
// it's responsibility is to format nicely all the stats about a review using one grading strategy | |
Text stats = new ReviewStats(review, grading) | |
new Mailing( | |
new Text("bla bla introduction"), | |
stats | |
).send() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment