Website design: if a system or web site is running normally, and the desired operation needs are reached, many of them are connected with the system in series. In the process of the design of the system interface, there are two problems, which are very concerned about how to design interfaces for other system calls and how to call the interfaces of other systems.
How to design the interface?
1. generally speaking, it is stable and less variable to publish interfaces to other systems. Therefore, it is a prerequisite to take into account various factors and possible factors in the future, so that we can minimize the change of interfaces.
2. of the data check is not passed and failed, it is best to have clear and clear that returned to the caller.
3., for the interface to generate transaction data, it is best to write log, record the data transmitted by the caller, so that it is convenient for future search and can not expect all callers to write log.
The use of variable type 4. interface to universal, especially for the use of this interface absolutely ignorant of user case, the other party may be JAVA, or VB6, may also be a specific type of C#, do not use a programming language, I think it is a good, parameters and return values are string type, such as the basic the programming language can support, then the parameters and return to use XML to define. When the interface is published, the interface definition document is published together, preferably with the XDL document.
5. the interface receives the data from the best data tested, because you can not guarantee that other system will give you full compliance with the standards of data.
How to call the interfaces of other systems?
Because it is the interface of other systems, direct call on the line, nothing, in fact, in fact, the following are some of the experiences I have summed up, or very useful.
1. for other system call interface will produce data transactions, must write Log, the future data error, it is necessary to find the source of the problem, especially the other system interface does not write log, once the data, often do not know where to look, there is a problem we give the data, or the other system to deal with problem we give data? In a recent project, because we have the data logic is very complex, and the other interface receives data we generated, will do a very complex data exchange system in action, the beginning of the line, there are a lot of sense of its second data, and we are in to call each other by writing log data interface when, soon found out some problems we have generated data, some other problems of data processing.
2. do not use other programs in various places directly system interface, it is best to write a class to encapsulate other system interface, if other system interface, can be dedicated to build a project management, such as interface changes (such as the interface, interface type), only need to replace the project DLL can, and other parts of the program can not change, not in all parts of the program directly call other system interface.
Interface development is to make the function of the system more perfect, and also a necessary way for a system to expand continuously. In addition to calling the original interface of the system, the designer also learns to design and develop interfaces to serve the system.
沒有留言:
張貼留言