Summary of recent PHP Projects

Source: Internet
Author: User

1. Requirement sorting

I have been relying on product managers for a long time. Now, no product manager can do nothing. We need to change our thinking later, and estimate the possibility of mixing small companies in the future.

The product manager of this project only explained the process at the front-end. It started, and the background was basically not mentioned. As a result, some designs did not fully consider these issues.

Therefore, a clear requirement is very important. At the same timeProgramIt is important that you constantly ask for products and discover hidden requirements. Many of the requirements are discovered only when asked about the product.


2. Database Design

At the beginning of the database design, we only designed the front-end, and later we continued to add background things. These cause some problems.

Some common experiences: small fields, etc.

The index is usually added at the end, and it is found that in practice, it does not follow the general saying.

For example, to query orders: We certainly mostly query abnormal orders, so we can actually create an index for the Status field. Because we will not always check the successful ones. At the same time, it is generally associated with the time, so the joint index of the time and status can be established, and the time is placed in front.


3. Program Design

First of all, object targeting is absolutely boring!

Second, it is more difficult to fully follow the book-oriented object.

Again, PHP uses object-oriented and TM.

I don't know how long the lead will give you an Internet project. The lead says it will take two weeks. In fact, it took me two months (this is a rewrite of the previousCodeIn fact, they used to spend more than 1.5 months on this project,

The first is to increase the previous requirements and procedures.

 

Second, I use the classic three-tier architecture, although MVC has a framework. However, I must use the data access layer and business layer. Fortunately, the business interface layer and data access interface layer are useless. This increases the code by at least 50%. At the same time, maintainability does not necessarily increase a lot. Instead, you have to trace errors at different layers. Switch back and forth among multiple files. It delays the time. It is very good to apply object-oriented to simple and detachable tool classes at the underlying layer. Such as network tools and log tools. At the same time, complicated logic and different state conversion conditions. If I use the golden book object-oriented analysis, I am not an object-oriented expert. it is really time-consuming to analyze it. I don't know what a master is like!

PHP's object-oriented, chicken ribs. First, call the method. The character is actually a keyboard operation rather than a particularly familiar letter. Second, the implementation method is similar to the array method, but the method and object call is more than the array hash query. In fact, the returned array is simpler and more direct than the returned object. Furthermore, there is no method overload. This made me crazy. It is also a weak language. The sum of the two is nondescribable. In the end, I always think it is a waste of resources. Sometimes you only need a few attribute values, but the object is returned and all attributes in the database are returned. It is especially difficult to associate queries. It can be solved by an SQL statement. But for the so-called object, you have to find the three objects. Then you checked the database three times.

 

Some small experiences:

1. I used to say that GBK is no longer needed. This time, we say that GBK can reduce storage space. Okay, I will use GBK. The result is poor. Some GBK characters are not recognized. However, some abnormal characters may appear in my system. Later, we checked that the interfaces of others called in the background are also GBK. Well, they don't support it anyway, so forget it. At the same time, JavaScript Ajax is UTF and must be transcoded. Transcoding is also required for JSON. During XML parsing, You have to convert it into utf8 and then convert it back. Bid the disk, and now the prices of cabbage are all ah. Even if the index occupies less space, the index fields are generally numeric.

OK, use utf8 encoding! Always use utf8.

2. Pay attention to digital computing

No floating point type, no floating point type. For rich computing, the unit is used. This prevents loss of precision when addition or subtraction is performed. It seems that there are not many points in a single query, and the number of times is a big number.

Excel is not reliable. when the account is exchanged, the financial account is reduced by 1 point based on the fractional addition and subtraction of Excel. It is particularly important to note that this may be the reason for the fact that sometimes the procedures and finance are not the same.

PHP is better to use = to prevent the problem that "12345" and "12345" are equal in the previous blog post.


3. Communication between the two parties

Record all original logs for future reference.

When stable communication or communication fails, you must consider that the other party cannot receive your request.


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.