I like it because for me a class like this is actu...
# announcements
p
I like it because for me a class like this is actually rather a function than a class with actual methods. So this ready naturally.
n
To me it’s not natural at all. Formatter is a noun, why does it take a parameter? It’s like you’re creating a new formatter or something. It’s confusing. In your case, it’s better to create an extension fun for Recipe or simply override toString.
p
It's an example; it has a bunch of dependencies. Naming could be more accurate - corrected.
a
I know this is a rather contrived example, but why not use a plain function instead of a class?
p
Because it has like 5 dependencies and it's a pain passing then all to the function @Andreas Sinz
a
You could partially apply the function, instead of
Copy code
val formatRecipe = FormatRecipe(x, y, z, a)
you'd have
Copy code
val formatRecipe = { recipe -> recipeFormatter(x, y, z, a, recipe)
👍 1