| ▲ | Joker_vD 2 days ago | |||||||
> However, there’s still one issue: Backup only calls Save, yet the Storage interface includes both Save and Load. If Storage later gains more methods, every fake must grow too, even if those methods aren’t used. First, why would you ever add methods to a public interface? Second, the next version of the Backup's implementation might very well want to call Load as well (e.g. for deduplication purposes) and then you suddenly need to add more methods to your fakes anyhow. In the end, it really depends on who owns FileStorage and Backup: if it's the same team/person, the ISP is immaterial. If they are different, then yes, the owner of Backup() would be better served by declaring a Storage interface of their own and delegate the job of writing adapters that make e.g. FileStorage to conform to it to the users of Backup() method. | ||||||||
| ▲ | brodouevencode 2 days ago | parent [-] | |||||||
>First, why would you ever add methods to a public interface? In the go world, it's a little more acceptable to do that versus something like Java because you're really not going to break anything | ||||||||
| ||||||||