Interface Design principle interface type
Simple data query interface: Action, façade, DAO with business logic data query interface: Action, façade, biz, DAO simple Data Write interface: Action, façade, DAO with business logic data write interface: action, Façade, biz, DAO Synchronous Interface design principles for asynchronous interfaces
Interface coarse grained an interface represents a complete business function
Reduce network interaction between systems to prevent the number of business interfaces explosion solve the problem of Dubbo interface. Interface version <dubbo:service interface= "com. Xxservice "version=" 1.0 "/>
Provides possible interface compatibility for late-stage incompatible upgrades
Compatible to:
Add method service model increase field incompatibility need to change version number
Delete method Delete model field Enum type new field is also incompatible with exception handling
Use throw exception to report error instead of return error code, exception information can carry
More information, and more semantically friendly.
If you are concerned about performance problems, if necessary, you can get rid of the exception class by override
The Fillinstacktrace () method is an empty method so that it does not copy stack information. The query method does not recommend throwing checked exceptions, otherwise the caller will
Many try...catch, and can not be effectively processed. Necessary interface input parameter verification
Configure consumer-side properties as much as possible on the provider
As a service provider, clearer service performance parameters than service consumers, such as timeout for calls, reasonable number of retries, etc.
After the provider configuration, consumer does not configure the provider configuration value, that is, the provider configuration can be used as the default value for consumer. Otherwise, consumer will use
Global settings for the consumer end, which are not controllable for provider, and are often unreasonable.
Service System Division Vertical division of the book according to business independence Notice of no status