Most of the J2EE(Spring and JPA) classes are designed with interfaces. Except for inheritance, are there any technical reasons for this? Like dynamic proxy
Interfaces for one are contracts as I see them . For example , a set of software engineers(Implementation classes) may have a specific contract with a company(Interface) . The company may choose to switch between the engineers from time to time based on the project needs . Since they come under the same contract and follow the same rules , switching is easier than bringing in a resource from outside (writing a new class) every time the project needs change . You just have to change the configurations to switch the implementation classes .
Interfaces are clean and is a one point access to the rules which the classes implement .
Links