Smart Client technology
Smart Client(Smart Client), Combined with a thin client(B/SMode)And fat client(C/SMode)Is the next generation of client software technology.
To understand the Smart Client, you must first understand the advantages and disadvantages of the thin client technology and the fat client technology.
For the former, a typical application is to use a browser and InputURLRemotely access the server and send commands to the server to obtain the resources of the server, which is then displayed in the browser of the client. Because the technical data is stored on the server, the client application interface is also generated by the Server File. Therefore, the client consumes less resources and does not have high requirements on the client device, you only need one browser software and available network to start working. In addition, if the system needs to be upgraded and modified, you only need to update the file on the server. When the customer accesses the file again, the new application system can be used. Therefore, the deployment and upgrade focus on the server, which is easy to implement. HoweverB/SThe mode depends on the network. When the network is unavailable or the performance is unstable, the client may become an "Dead interface"-You cannot send data back to the server for storage, you cannot obtain data from the server to obtain the client operation. All operations will continue after the network recovers.
for the fat client technology, the biggest sensory experience you get when using this software is-it first has its own unique application Program interface, instead of using a browser, users can even adjust the layout of the software based on their preferences to set rich interface elements, these are not comparable to the B/S thin client technology. In addition, the user can get a fast response speed, the program can make full use of the resources of the local machine, when the network is not used to access remote resources, access to local resources can be processed quickly under normal circumstances. Similarly, the fat client technology is also unsatisfactory-when the client is deployed, it may be difficult to deploy the client due to various situations, if you upgrade the software version and use the traditional DLL technology, it will be even more challenging, because in . net earlier, Standard Windows DLL component may contain " DLL hell " -- when the DLL in the software is registered and updated, the shared DLL is found. the latest version is rewritten, and other software on the machine cannot be run. The fat client may need to implement database support on the client, and putting the database locally may lead to some security problems, because the client is relatively weak compared with the server that focuses more on security.
Then the Smart Client technology emerged, except for fat/In addition to the advantages of the thin client, it also has the following four biggest advantages --
1)Make full use of the advantages of terminal Devices(Full PC, PDA, phoneAll can meet)Because the core part is on the server (possiblyWeb Service), So the terminal only needs to implement the presentation layer and some simple logic;
2)Ability to callWeb Services, InServerEnd-to-EndWebThe Service implements the business logic and processes various requests. It must be noted that, because the business logic is implemented on the client, the client is reduced while the software is also enhanced in concealment and security;
3)Online and offline statuses are supported. You can continue to work when the network is unavailable and temporarily store the data locally. When the Network is available again, the data can be transferred to the server;
4)Can be likeWebApplications are generally easy to deploy,. NetWith the assembly technology, different versions of the same software can coexist on the unified client. The version upgrade is also very simple. The software accesses the server and can automatically detect the version number to update key components and implement the upgrade.
II, What is the purpose of this technology? What are the prospects?
ActuallySmart ClientIn some traditional software technologies, we can also see some shadows.. NetSo that all aspects of this technology (client display, data connection, online and offline operations and deployment) can be seamlessly implemented. Therefore, this technology is a new client technology solution and a technical method that can be implemented on various terminals.
Building a desktop-level software into a smart client can enhance its functionality. As the network is infinite, you can get more information by jumping out of the desktop.
Based onInternetOrIntranetAnd BrowserB/SThe existing Smart Client software can expand its scope of work without relying on the network, and make full use of local resources to accelerate work efficiency. The advantage of easy deployment is more available for enterprise-level applications. Developers only need to simply publish and deploy the applications on the server side, so that clients can be updated synchronously.
Some applications that can use this technology --
"After-sales service system": after-sales service personnel are allowed to create repair tickets and packing lists in offline form, which can accelerate local work efficiency. When the Network is available, then upload the data to the server. You can obtain the required information from the server. If the version of the local software is lower than the highest version of the server, you will be prompted to perform seamless online upgrade, which greatly reduces deployment guidance for developers.
With. NetFurther technical maturity, especiallyWeb ServiceMore extensive application of technology, and full support for Microsoft's future systems. NetI believe that the Smart Client technology will become the preferred solution and be applied to various software technologies.
III, How to use this technology (through case studies)
Smart Client programs generally have the characteristics of occasional connections, so I focus on Occasionally Connected Smart Client Applications. At the same time, there are four ways to communicate with the network --Enterprise Services,. Net remoting,Message Queuing (Message Queue)AndWeb Services. Based on the general viewpoint --WebA service is the best way to generate most smart client applications. Therefore, in the selection of service-oriented methods and data-oriented methods, I decided to select the former. Therefore, I will focus onToWeb ServicesAs the preferred communication method, service-oriented Smart Client technology.
The key to designing the service-oriented Smart Client technology is to solve the following problems. In order to make the story clear, I will use a case as an example.
We need to implementBook Purchasing software (name itBuybook)The server has a database that contains two data tables. A table briefly describes the prices of books. These prices are changed. The administrator can use tools to modify the data in the table. The other table is a book order and records the order of the book.ID, Book subscriptionIDAnd the order quantity. Two tables only contain booksIDAssociated as the primary foreign key. The server also creates the required functionsWebService for the client to call.
Next we will continue to talk about the service-orientedSmart ClientKey technical issues.
1)Connection Management
Of course, the Smart Client software cannot access the server on the network too frequently, because this seriously affects the performance of the software. In addition, the software should also respond to connection changes (such as manual connection, automatic connection, unexpected disconnection, and long-term disconnection) to reflect its Smart features.
So what are some suitable solutions for connection management? I will take the example I gave as an example to design its processing methods in this regard.
BuybookAvoid interacting with the server on the network, even if the network connection is available. YesAssume it is an offline operation., Local transaction processing on the machine. Of course, this will cause some problems. It is possible that the system data is not synchronized with the server data, resulting in invalid local operations. For example, the price of a server book is kept as a system parameter locally. When the system data changes, the price of the book you see on the client is not a real market. Therefore, although offline operations are prioritized, data inconsistency should also be taken into account, and data conflict processing will be answered in detail.
In some special examples, for example, when purchasing a stock, because the stock market is constantly changing, in order to make the local data reflect the real situation, the network connection should take a time interval to interact with the server. The time interval can be customized or the system default.
We can also provide users with such a function. They only need to click a button to send out a command to access the server. At this time, the connection is established and the connection is maintained until it is manually disconnected, or the network is unavailable. We call it"Manual connection", Which corresponds to"Automatic Connection", When the connection is available, keep the connection status, process the data in the cache, send it to the server, and obtain some of the server's latest common system parameters.
All in all, when designing a system, you should regard the connection as a luxury and treat the network elegantly. No matter what the network is, users' data operations can be cached locally.
2)WebService Interaction
service-oriented Smart Client applications, the focus of interaction between the network and the server lies in Web Service . As mentioned above, the remote interaction on the server should be reduced, local operations can be cached, and Web during service interaction, you do not have to wait for the returned information. You can perform other operations in this delay. To achieve this function without affecting the work, the most effective method is to use Asynchronous Communication, and multithreading can be considered.
WebService UsageXMLTechnology,Crud(Creat read update Delete) Database operations can all be performed throughWeb Service. So pay attentionWeb ServiceThe interaction method is defined. When the customerCreateThe operation may be associated with system parameters, suchBuybookApplication. When a customer submits a purchase order,WebThe Service should first check whether the price of the local product is the same as that of the server. If the price is different, the customer should be prompted to update the latest price and then determine the order behavior.UpateAndDeleteOperation, which may cause data conflicts. For example, the deletion action should mark the relevant records on the client as temporary deletion, and then delete the Request queue on the server. When deleting a log service, you must check whether there is any data conflict. If there is a conflict, you must handle the data conflict.
3)Local data cache
In order to respond to user operations in a timely manner and to meet the needs of offline work, Smart Clients must cache frequently used fixed server data locally.
If the connection is online, local data can be temporarily stored in the memory,Ado. netInDatasetIt is a temporary data object that can be stored in the memory. The data stored in the memory is only a temporary transition. When the data needs to be saved back to the remote database after the operation, the method can be used.DatasetData adapterDataadapterReturn the changed quantity to the database, which accelerates local response and saves bandwidth.
If the application is disconnected, the data is stored back to the local data storage structure.Dataset.
4)Data conflict Processing
The most common cause of data conflicts is that the data may have been deleted when the user performs an update or delete operation, so that the application cannot find the updated or deleted items, it will naturally cause exceptions and errors. To handle this situation, you can use a simple method, data adapterDataadapterYesDatasetChange-when data is returned to the database,DataadapterOfUpdateMethod can be checkedDatasetIn eachDatarowOfRowstateTo determineDatarowIs it the latest, modified, or deleted, and then perform appropriate database operations, as if the data cannot be found,DataadapterThe affected number of rows in the database is not greater than zero, and an exception is generated to stop the update. Then, the application can use this exception to handle data conflicts.
If the server does not have the raw data to be deleted, delete the data from the client. If the user changes the data, the user can first check the data on the server to check whether the data exists. If not, the user is notified and the user's operation is invalid, delete the local expired data.
IV, Summary
The Smart Client technology is a promising next-generation Client technology that can work flexibly in the case of network connection and network disconnection. For users, this will be a new kind of software user experience, can have at the same timeC/SRapid response of the Mode Software, rich user interface experience, and simple deployment and upgrade of the thin client mode. For developers, development becomes more difficult and there are more considerations, but there are still flexible solutions to choose from.. NetTechnology, the use of service-oriented or data-oriented solutions, in development, should focus on solving "connection management","WebService interaction, local data cache, and data conflict processing.