Forum on Community PHP business development

Source: Internet
Author: User
In the current rapid development of Internet businesses, new products have sprung up, and new businesses of old product lines are constantly breaking through and trying. This puts forward higher requirements for rapid development iteration. 1. The basic operating environment for new product development must be able to quickly build a LAMP architecture. Select a webserver and a php version.

In the current rapid development of Internet businesses, new products have sprung up, and new businesses of old product lines are constantly breaking through and trying. This puts forward higher requirements for rapid development iteration. 1. The basic operating environment for new product development must be able to quickly build a LAMP architecture. Select a webserver and a php version.

In the current rapid development of Internet businesses, new products have sprung up, and new businesses of old product lines are constantly breaking through and trying. This puts forward higher requirements for rapid development iteration.


I. Basic Runtime Environment

To develop new products, you must be able to quickly build a LAMP architecture. Select a webserver, a php version, a mysql version, a PHP development framework, and some common php extensions and basic libraries. In this process, the reader may think it is very fast. Can it be faster?

The selection process requires R & D personnel to accumulate relevant technical directions, weigh the advantages and disadvantages and give priority, and conduct research and study. If you have a one-click installation program, it provides automated installation of webserver, php, mysql, and php development frameworks with high performance and flexibility, and provides standardized, secure, and commonly used configuration files, it can greatly shorten the cost of LAMP system research in the product line and shorten the work cycle.

One-click installation Step 4: (1) download; (2) a small amount of configuration; (3) make install; (4) start; (of course there are end, simple O & M tools ), running Environment OK.
Ii. Business Development Framework

The Community product lines are independent and closed to develop their own business logic. In fact, there are many common business logic processing between various product lines, such as session verification, permission judgment, parameter verification, and log printing. If all requests of different product lines need to be processed, can we develop them repeatedly? There are many differences between wireless business development and PC business logic, but there are also many versatility between different product lines. Can I develop it repeatedly?

The product line usually abstracts the processing of these general logic internally and designs the ActionChain form or the scheme through the base class. The framework will be more thorough: The general logic for all these requests to be processed is provided in the form of a business logic framework. Developers only need to focus on the proprietary logic processing of user requests.

The processing logic of a user request is as follows: the blue part is the processing process of the controller framework, and the green part is combined with the Controller framework to process the general business logic of all requests. However, developers need to pay attention to and develop the dedicated service processing for this user request, that is, the yellow part (of course, it is not just an Action script, but the processing of a request will be horizontally divided by mvc, this will be involved in the future .)

The business logic framework is provided in the one-click installer, which can be obtained simply.

Native PHP businesses are deeply coupled with Templates without any hierarchical design. The result is poor code reusability. Such an original PHP system is now almost extinct. The PHP Development Framework processes routing, rendering, AutoLoad, general business logic abstraction, basic library abstraction, and proprietary business MVC layering in a unified manner, which has greatly accelerated the development of product line business logic. As shown in:

The top and bottom layers are the access layer (high-performance webserver), PHP development framework (routing, automatic loading, view engine, etc.), applications, basic libraries, and storage engines.
Iii. General Services

The Community product line has many common requirements, such as log processing, configuration file processing, string processing, database interaction, and network interaction. These algorithms and tools are encapsulated into phplib for product line use.

The business functions of Community product lines have many versatility, such as comment, Tag, friend, Atlas, and task systems. Similar new functions are required in many Community product lines, design and development?

These requirements have Personalized Requirements on the UI of various product lines, but the backend implementation solutions are similar and universal. Functions are service-oriented and API interfaces are provided for different product lines. The product line only needs to focus on the display logic and the processing logic of private data, and the service O & M is unified to reduce the system complexity under the product.
Iv. Vertical Split Subsystem

As our business expands, the number of UIS and modules inside a single application is increasing. Action and Logic (corresponding to the M layer in MVC, further layer processing can be performed internally, not detailed here) the interaction between logic and logic becomes more and more complex. Developers need to understand the logic of the entire application. When upgrading a logic, they need to check whether there are reverse dependencies of other ui or logic in the entire application. Under the requirements of rapid development, developers are not clear about the coupling relationship between logic, which will inevitably lead to more and more problems, affecting project quality and making it difficult to start development.

More and more single system problems are exposed, and it is time to split the system. How to split it? Vertical Split by business logic. Separate the independent business logic to form an independent sub-system. In this case, we also need to consider the versatility of the business. Can it be servitized? Does an application have a common service with the same requirements? At this time, the general business logic is encapsulated into a general service or a General Service, and the bypass business logic is independent into a sub-system, so that a large system is greatly reduced. After restructuring at this stage, the system is added as follows:

A single system is split into multiple apps (the APP still has a horizontal MVC hierarchy), and a large number of general services are reused. In this way, the R & D team has greatly improved the division of labor and parallel development.
V. Cross-System Call framework

However, in reality, dependencies cannot be completely eliminated between sub-systems after splitting. To solve the data dependency between multiple subsystems, a unified solution is required: API framework. Subsystems become independent applications, and there is mutual data dependency between apps. These dependencies are provided externally in the form of APIs. For example:

When APP1 depends on the data of APP2 or APP3, APP2 and APP3 provide some data interfaces in the form of APIs and pack the data in a unified manner, provide other APP calls within the product line through standard URLs. This form is very similar to a product's open API (Open API to a third party, called openAPI, which complies with the unified protocol and passes necessary permission verification ), the API interface that solves the data dependency between internal subsystems can be further simplified.

The APIS provided by the APP provide interface descriptions (input and output), process API URLs, and implement Logic forwarding. API_LIB manages all APIs in a unified manner, and provides a unified API_Server: call interface for calling. Completely blocks internal forwarding and implementation details. Generally, to simplify and unify O & M, all subsystems are deployed on the same machine. API interfaces consume additional network resources and increase qps. Under the premise of this deployment, the implementation method of API_Server can be implemented through HTTP call or optimization to the direct PHPRequire method. Advantages:

(1) unified framework, interface convergence, and business decoupling;

(2) improved performance, high ease of use, and high scalability;
Vi. UI split Model

At this time, the independent subsystem can focus on its business logic, and the core system can also be reduced. However, the upgrade frequency of the core system is the highest, and the business logic is also the most complex. By a certain period of time, the core system has become bloated and difficult to maintain. In this case, some design patterns can be used to reduce the scalability and maintainability of the program. However, even so, there is still a certain learning cost. In an App, developers need to pay more or less attention to the code of other modules. As they gradually develop to an upgrade, they need to troubleshoot many issues. At this time, it is time to further reduce the burden. If it is reduced? There are two parts:

Step 1: asynchronous model

Page rendering is divided into two phases: topic page data and other non-topic page data. Data is provided by different data sources based on different parts of the page. This logic further splits the app vertically.

PHPService is a thin UI added by PHPmodule and returns formatted data.

Step 2: Synchronous Model

Module is split. Different business logic is split into different modules, which are divided into multiple data sources and provide different data content. After different data sources are scheduled by the Unified UI, uniform rendering page return response.

After this continuous reduction, more subsystems and modules within the product line will need to be maintained, and unified deployment and O & M are required. The division of labor among team members is very fine, and the business understanding is very focused and in-depth. The efficiency of cooperation and parallelism will also be higher, thus shortening the entire development cycle.
VII. Summary

As the business logic grows improperly, if the business functions of each subsystem or module are too bloated, we need to reduce the score continuously to maintain a controllable scale. As the product develops, more subsystems and modules within the product line need to be maintained, and the deployment and O & M needs to be unified to keep the system simple. The division of labor among team members is finer, business understanding is focused and deeper, and collaboration and parallelism are more efficient, thus shortening the entire development cycle.

From: http://stblog.baidu-tech.com /? P = 1954

Original article address: [go] Let's Talk About community PHP business development. Thank you for sharing it with the original author.

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.