Mobile application software development to achieve the same way with ordinary PC software

Source: Internet
Author: User
Keywords Project experience learning summary
Tags abstract application application software application software development applications business business functions change

First of all, I am here to explain the interface, not the code in the interface, but the interface project, do not have to look down if you want to go wrong.

The widespread popularity of mobile phones today, mobile applications will also be more and more, and the growth rate is very fast. Mobile application software development to achieve the same way with ordinary PC software is also divided into BS and CS mode. The use of CS mode, most of the server-side interface to provide data in the form of interactive data (mainstream data interaction are: Json, WebService, etc.), Today is how to design the interface.

As a bridge between the client and the database, the interface plays a decisive role, which directly affects the efficiency, stability, reliability, and correctness and integrity of the data. Client is focused on the beautiful interface, easy operation, is the user experience the most direct experience, and the interface is all the data providers, users of the deep meaning of the experience.

Because of this, designing the interface in a project is very important. Then I summarize the current experience how to design a reasonable interface.

First, the design principle

1. In-depth understanding of needs

In addition to the design of the database most people understand the needs, followed by the design of the interface, and sometimes even interface developers have to participate in the database design. From the "Client - Interface - Database" level, the interface obviously plays the role of Shangqie Kai, on the one hand to understand what the interface data, on the other hand to consider how to get from the database, the organization of data. So if you do not understand the requirements, you can not abstract the object to the correct organization of data to the client, can not verify that the data structure of the database can meet the demand. Database designers to understand the needs of the data structure, while the interface is more to understand the needs of the logical structure and the resulting logical data structure.

Understand the database structure

Since the interface to understand how to get from the database, organize the data, of course, to understand the structure of the database.

3. Understand the client prototype

To understand the prototype, in fact, more is to help you design the interface needs to provide data and structure. But sometimes when you design and there is no prototype, so this is not a requirement. But if the prototype after the interface design came out, we can also take prototype also verify the interface design is correct and reasonable.

Second, the design principles

1. Good reason

Not just a function should have an interface, nor is it just a need to add an interface. Every new interface, there should be sufficient reason and consideration, that the existence of this interface is of great value, meaningless interface not only increases the difficulty of maintenance, more importantly, the controllability of the program greatly reduced , The interface will be very bloated. So I put the first one.

2 clear responsibilities

An interface is responsible for only one business function. It is similar to but different from the single principle of responsibility in design mode. Because a business function may include multiple operations, such as querying a member, it may acquire the member in addition to querying a membership list Other necessary information, but not inquiries while members also have other business functions such as modify permissions, should be divided into two interfaces to do.

3. High cohesion low coupling

An interface to include the full business functions, and business associations between different interfaces to be as small as possible. Or query members of the example, sometimes members inquiries at the same time, may the member of the relevant information to be changed (such as state), if a complete business line at this time, it should be done in an interface, and should not be Set up a separate interface to complete the operation. In other words, an interface should not change with another change or exist on the premise of a few interfaces.

4. Analysis of a clear point of view

Design interface analysis point of unity to be clear. Otherwise it will cause confusion in the interface structure. For example, do not design for a while in terms of a character, but for a while make a functional point of view.

5. into the reference format unified

All interface parameter format requirements and style to be uniform, do not have an interface parameter is comma-separated, the other is the array; do not have an interface date parameter is x year x month x day style, the other is xxx.

6. Status and news

Provide the necessary interface call status information. Is the call successful? If it fails, what is the cause of the failure? These necessary information must be told to the client.

7. Control data volume

An interface return should not contain too much data, too much data is not only complicated to deal with, the pressure on the data transfer is also very large, will cause the client to react slowly. Too much data is often unclear interface partitioning.

8. Do not arbitrarily expand the parameters

Similar to Article 1, it is only for parameters. Future expansion of the interface may be difficult to avoid, but do not arbitrarily add parameters, add parameters must be necessary and meaningful, the first change in the needs of the existing interface should be considered whether the internal maintenance to meet the demand, but not by adding a parameter to facilitate Difficulty to achieve their own needs, because changes in parameters will directly lead to changes in client calls, prone to version compatibility issues.

Third, the design method

Abstract business

Compared to abstract objects, the abstract business more macro, I think it is relatively easy, but the abstract scale is often not very good grasp.

2. Data format

The data format of the interface definition must be fully considered, otherwise errors such as data conversion failure or excess length will occur. If you are unsure, it is most appropriate to set the string directly.

Meaningful naming

Whether the interface or parameters, the name should be meaningful, people can see clearly.

In short, the interface design is a meticulous work, the design will have a lot of contradictions, but individuals tend to coarse-grained design direction (ie cohesion higher), so not only to the client browser interface is easy to understand, easy to maintain , The disadvantage of doing so is that an interface is not very flexible when extended, but it can be remedied by redefining an interface, but as mentioned above, the new interface still needs to be considered twice. Although many of the above are theoretical explanations, but firmly remember these, combined with the actual work, it will slowly and profoundly understand the meaning. That theory to guide practice, practice to verify the theory.

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.