https://kotlinlang.org logo
#feed
Title
# feed
m

Markus Bergkvist

10/11/2017, 6:06 AM
@wakingrufus Nice write up. Thanks for sharing. I'm all for DI, but here are my thoughts on your example.
fun fizzBuzz
does two things; generating a list of fizzbuzz-numbers and present the list (print). I would separate the two (single responsibility principle) and either have
fun fizzBuzz
return the list of fizzbuzz-numbers or perhaps even better, yield the values, and the do presentation somewhere else. Thus making DI superfluous in this case.
w

wakingrufus

10/11/2017, 12:08 PM
I agree, but the code here was just to illustrate the technique. If I was actually trying to do fizzbuzz, I would not do it this way
2 Views