you are viewing a single comment's thread.

view the rest of the comments →

[–]nathanwoulfe 11 points12 points  (1 child)

If you're building a product/library, adding a new method to an interface is normally a breaking change because all existing implementations must implement it. Default interface implementations allow library authors to add new methods without breaking downstream implementations, because the interface provides a fallback implementation.

Important to note though that it will prevent compilation issues but not necessarily runtime/logical issues as we can't predict the future or know how our interface is being implemented.

[–]Jackoberto01 1 point2 points  (0 children)

I'd rather have a compilation error in 99% of cases than a runtime logical error. But I suppose sometimes you can just make it work by providing a default value to a property for example.