You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would have expected, that in the ‘good’ example, the function will take a parameter of type ‘EchoIf’
You could have showed that there is an ‘Echo’ class with the actual implementation, and an ‘EchoIf’ interface class that abstracts the ‘write’ method.
this is basically the whole point, your function depends on an abstraction. it is clear that in order for that function to work, it is required an object that implements the ‘write’ method.
as it is done now, the function hides a dependency on the Echo class. you are building the object inside the function, instead of delegating this responsibility to a different function.
Also, same function builds ‘rows’ object with a default value, a thing that you have said in previous example that should be done using parameters with default values.
The text was updated successfully, but these errors were encountered:
hi,
I would have expected, that in the ‘good’ example, the function will take a parameter of type ‘EchoIf’
You could have showed that there is an ‘Echo’ class with the actual implementation, and an ‘EchoIf’ interface class that abstracts the ‘write’ method.
this is basically the whole point, your function depends on an abstraction. it is clear that in order for that function to work, it is required an object that implements the ‘write’ method.
as it is done now, the function hides a dependency on the Echo class. you are building the object inside the function, instead of delegating this responsibility to a different function.
Also, same function builds ‘rows’ object with a default value, a thing that you have said in previous example that should be done using parameters with default values.
The text was updated successfully, but these errors were encountered: