4 ms·
I try to use interfaces that have single methods only. The problem with multiple methods is that you can abstract away the function call, but you can't ensure
by cel1ne 9y ago
I try to use interfaces that have single methods only.
The problem with multiple methods is that you can abstract away the function call, but you can't ensure the caller is the methods in correct order (if that matters, but it often does).
- flukus 9y agoThe caller should be able to call the methods in any order, it sounds like you have some horrible stateful code.
- cel1ne 9y agoYou are wrong. Most interfaces in non-functional languages are stateful. Take the JDBC-interface: It's certainly not possible to call setTransactionIsolation(), executeQuery(), commit(), rollback() etc. in any order. Or list: add, remove, set, clear etc. It's still an interface.