Cerl2 Series 6: SDL, Data Stream-oriented network protocol

Source: Internet
Author: User

In cerl2 Series 5: SDL and my thoughts on network protocols, although I have introduced the ins and outs of SDL, I found that very important content is missing. My friends may ask, isn't SDL a common IDL (Interface Description Language)? Why not simply stick to a ready-made standard?

 

Many times, similar things seem like God or not. It is because I think IDL does not conform to my opinion on the network interface protocol that SDL is available.

 

First, most IDL are object-oriented. However, I think network protocols should be data-oriented. Why Is Object-Oriented in network protocols bad?

 

The reason is simple. Object-oriented network protocols will inevitably increase the complexity of implementation. Because we can pass objects in the network stream, naturally, the objects need to have a stub on the server and a proxy on the client ). What is particularly annoying is object lifecycle management. These make it difficult for the server and client to implement. If the complexity of the server is increased, the difficulty of the client is increased, which makes inter-language protocol calls more difficult.

 

The Data Stream-oriented network protocol is intuitive, eliminating all the burden of object-oriented. We have a very clear concept of the data transmitted in the network. After a simple understanding of the protocol details, you can quickly make a client call code in a new language without any foundation.

 

Simple is beautiful. This is the charm of data stream-oriented network protocols.

 

Another simple aspect of SDL is the description of SDL interfaces. For such a statement:

 

[ID = 2] Get (string key)-> {OK, string Val} | false;

 

You can see that "->" indicates the request package before the symbol, "->" indicates the response package. This is very intuitive. You can compare the following statement:

 

[ID = 2] bool get ([in] string key, [out] string * val );

 

The reading experience of both is not in the same grade.

 

In particular, when there are many response branches, the second method of description will be terrible.

 

Therefore, SDL is the best interface for describing network protocols from various perspectives.

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.