Tiburon logs 2 datasnap and JSON
What is JSON? I don't think I need to say more about it, because there are a bunch of JSON statements on the Internet that can be searched by yourself, simply put, JSON is a kind of data processing format, popular in the world of JavaScript and Ajax. OK. What is the relationship between JSON and datasnap? When datasnap is applied to a distributed architecture, does it not use COM/COM +? Why does Tiburon datasnap use JSON?
In fact, the first time I knew that datasnap was using JSON, it immediately appeared in my workshop, however, when I think about the answers to many questions, I can immediately see and extend many other ideas. Do you know why? Because when I look at any technology, I still like to see the background of the people behind the technology and the technical representatives, now let me look at the process I thought about in my workshop.
Remember Steve? It is now a Framework framework of Delphi/C ++ builder in terms of data access technologies. I have also written articles related to Steve, here, we explain the background of Steve from Java, therefore, in the VCL frame, I can see some java flavors in the programming environment developed by Steve Xiaoyun, specifically, Steve's background is clearly disclosed in some architectural aspects. Now that we understand Steve's background, what do you think Steve will do when Steve is looking at the development direction of datasnap?
Therefore, let us break down the previous questions ,:
Question |
Category |
Answer & direction |
When datasnap is applied to a distributed architecture, does it not use COM/COM +? |
This is a question about distributed architectures. OK. Think about it. When COM/COM + is no longer the mainstream, if datasnap still uses COM/COM +, it will become more and more blocked. |
Find a cross-platform and mainstream distributed communication protocol and information transmission protocol format. TCP + JSON is certainly one of the best options. |
Why does datasnap use JSON? |
This is a policy issue. After datasnap uses JSON, what kind of opportunities can it launch? Simple statement. Delphi/BCB can be immediately integrated with all datasets using the JSON technology. |
After datasnap uses JSON as the format of the distributed architecture principal information, it can not only restrict access to com/COM +, but also combine cross-platform (win64 can also be used ), it can also be used with Java, Ajax ,. net integration, so that Delphi can immediately integrate into the world of mainstream information formats on the web. |
What is the relationship between JSON and datasnap? |
This is an actual issue. Can Delphi/BCB use JSON to encrypt messages when providing a distributed architecture? |
Of course, JSON comes from the world of Java/JavaScript, but it is only a form of messages and messages. JSON is simple and fast, and the actual work is not complete. |
Therefore, it is clear that the datasnap scheme of Delphi/BCB uses TCP + JSON to provide a more hierarchical distributed architecture, and is also caused by JSON distributed architectures, therefore, the compaction speed will be ideal,
Another advantage of using JSON is that JSON also defines the format of a DataSet object. This is very interesting because dataset and delta in datasnap are all objects, why can't I use JSON to compile images? In addition, the method of the terminal object can also be viewed as an object, so further, maybe the original rtti of Delphi/BCB can be used to implement RMI (Remote Method Invocation) Like java, I think Steve must have thought this way at that time. If this can be done, it means that Delphi/BCB's End-to-End Server services can be called by the end-to-end client like Java, then, with the rich dataset/delta and other processing information functions of datasnap, this will be much more than the RMI metadata of Java.
The confirmation of such ideas is not only because the new distributed architecture of datasnap is displayed, allow Delphi/BCB to call the producer server without using COM/COM +, and Delphi/BCB can be immediately integrated into Java, Ajax and.. net.
But to do so, we still need to overcome the two biggest technical problems:
1 The original datasnap distributed architecture uses COM/COM +, and uses tclientdataset and other components at the consumer end to communicate with each other through the iappserver interface and remote data module at the consumer end, therefore, if the new datasnap uses TCP + JSON, how should the corresponding datasnap application be written?
2. the original rtti resources provided by Delphi/BCB are not very rich, while Delphi/BCB does not have any Java /. the reflection API like. net. Therefore, metadata of the complete terminal method cannot be obtained on the terminal end, and the correct method prototype is formed to call the terminal end's service method.
The first problem cannot be solved. The resulting datasnap will still exist in Tiburon (that is, COM/COM + can still be used ), the question is how to transparently enable the dataset architecture to use JSON. In fact, this is only the iappserver interface, therefore, we only need to use the adapter design example to solve the problem, that is, let datasnap use the terminal to terminate the new component, this component implements the iappserver interface in the same way, so that datasnap can use the terminal to assume that it is still connecting to the previous remote data matrix, however, in fact, it is already the component of the new architecture using TCP + JSON (that is, the tdsserver and tdsserverclass components we will discuss later ).
The second problem is the need for a new middleware. The metadata generated in the original rtti allows datasnap to call the middleware method on the slave end, this is the purpose of Tiburon's new scanner commands {$ methodinfo on} and {$ methodinfo off.
OK. After understanding these basic ideas and ideas, let's see how to use TCP + JSON in Tiburon to create a new distributed application, at the same time, we will refer to the location where JSON is the new distributed architecture.