For example, eating chocolate:
public interface IChocolates{}
public class Oreo implements IChocolates {}
public class Dove implements IChocolates {}
public interface Person { void eat( IChocolates chocolates ); }
The above example of human chocolate produced dependence, man eating behavior depends in fact nothing to do with chocolate, chocolate appears before existed, so eating action should be dependent on the concept of internal interfaces of the man himself, this interface ownership should belong to the people, the concept should be edible (edible). So people dependency on chocolate should be inverted dependency on edible chocolate interface . After this inversion has better scalability for people, not only can eat a variety of chocolates, you can also eat biscuits, rice, fish, and so anything else to eat.
public interface IChocolates extends IEdible{}
public class Oreo implements IChocolates {}
public class Dove implements IChocolates {}
public interface Person { void eat( IEdible edible ); }
Reprinted from: https: //www.jianshu.com/p/4e268c90e720