The author only describes several ways of client development, does not provide code, the reader can go online to find the appropriate code.
The first way of development:As we can see, the server is the client development bridge, whether direct or indirect, the World Wide Web to the HTML file distributed to a variety of servers, through the HTTP protocol to get to the HTML page, where the data is what we want. As an ordinary personal developer, we do not theoretically know the servers and databases of large enterprises, but the Web page is a household name, everyone can browse, and get all the latest news data. This provides a different approach to client development. We don't care what happens on the server side because they have all the data we want through the Web page (HTML file), which means we just need to simulate HTTP requests to get a Web page (HTML file), and then obtain the desired data by the appropriate parsing method.
steps:1. Simulation
httpRequest, which is typical of
request/corresponding model. 2. Read the byte stream from the returned data and get
HTML String。 3, take the corresponding technical analysis
HTML String。 (
Jsoup,
HttpagilipypackAnd so on, depending on the platform) 4, the use of data binding format to display data,
AndroidFor
Adapter,
WPFor
Itemsource, the principle is the same, all the data is extracted from the collection, and then bound to the item control. (Requires understanding
Linked list(List)、
Hash Table(HashMap) and other data structures)
Disadvantages:1, access to more steps, the cost is big. 2. Usually
HTMLFiles are relatively large, compared to
JSONData, parsing
HTMLThe file takes much longer.The
second way of development:With the typical Baidu weather interface (
JSONData), this is the simplest, because it returns the most lightweight data, and of course the return XML file, this is slightly more bloated, because it includes a variety of nodes, elements and so on. Step: 1, do not say more, is still a simulation
httpAsk, do not understand to look at the World Wide Web. 2. From the stream returned (it is possible to return directly
JSONString) to extract the JSON string. 3. Analysis
JSONString. In addition there are chat clients: QQ, forex, etc., based on
SocketOf
TCP/IPKnowledge is critical.
Advantages:Enterprise-class applications are widely used in the development model, simple and efficient low cost, easy to maintain, the deployment of a good server on the line.The
Third Way of development:That is the common browser client, there is nothing to introduce, a variety of browsers on the PC are.The
fourth method of development:Extract data directly from the database, which is common to lightweight clients such as Notepad, Sticky notes, and so on, and operates on a local database (
MySQL)。The
fifth method of development:In fact, this development method has a process is
The Third way of development, that is, it is derived from the third way of development, the principle is: Enterprise developers to write
SDK, a portion of the server's open interfaces are encapsulated into the corresponding
API, and then publish this copy
SDKFor use by other business or individual developers, you can
SDKDevelopment of the corresponding client, the most common is: Sina Weibo, Renren, etc.
SDKThe This way of development is very simple, because the various interfaces have been encapsulated, make the corresponding call.The
above content for the author original, if there is the wrong place, welcome point, declined reprint.
Client Development methods