Q: More and more Web 2.0 Web sites to the application platform, you think the key to building such a platform?
A: In simple terms, the application platform is the API, any AJAX or Web 2.0 types of Web sites, are used on the application Platform API to create a visual interface interactive effect. For example, Yahoo Mail, through a simple request call, to read the continuation of the letter. To create such a site, how to regulate the way to solve the problem, will determine the future expansion of the site (scalability), rather than the effectiveness of the development of the site.
Q: How to regulate the structure of the site, will have the expansion?
A: The application of a Web site, divided into dozens of separate small programs, the front-end through the API service, the backend is the application engine, this will naturally have extensibility. Because each part of the application, there are different levels of use, need to have different degrees of expansion (scaling level), need different mechanisms to deal with. To develop Yahoo Mail, it is to develop an address service program, a letter-reading service, a messenger service, and the Messenger program is completely unrelated to the reader program. On Yahoo's scale, these jobs need to be completely separated to be expanded.
Q: What is the most important key to this way of drawing a website?
A: The key is that you have to create separate, modular independent endpoints, not all in one big basket. Most of the current framework for MVC Architecture (MVC framework), using the so-called front-end controller (Front control), calls the front-end controller each time the request is made by the browser, and then the front-end controller is used to identify the Which program the user wants to execute. There is no point in doing so.
At the browser level, the program knows exactly what the user wants to do, such as when the user simply reads the letter, and the program does not have to send the demand to the server to determine whether the user wants to read the letter or the messenger. Pulling such decisions out of the browser and being processed by the server wastes a lot of server resources to work on those that have no real utility to the user. Extensibility comes from architecture, many development frameworks, tying everything together and limiting the architecture. If you choose the wrong development framework, you have no extensibility.
Q: Do you mean that the MVC pattern is not conducive to website extensibility?
The A:MVC mode is more suitable for use at the level of the Web Controller (page control). Basically, each of the Web controller is a stand-alone module, read the letter and check the address is a different Web controller, so, read the letter program will not interfere with the search address program. Therefore, it is not a problem to use the MVC pattern at each endpoint to create a small web controller. However, most frameworks that use the MVC pattern are preset to use a front-end controller in a Web site rather than a Web controller, and this MVC pattern is only suitable for small or single server sites.
Q: How would you choose a development framework?
A: Don't use a frame. However, from these development frameworks, I will find the features I need, take out the modules I need, or refer to the design ideas, rather than the entire framework. Most of the frameworks I see are not focused on creating efficient extensibility and modularity.
Q: Don't developers need frameworks or architectures?
A: The site does need to have architecture, everyone needs a framework, the framework is a way to solve the problem. But you don't need a generic framework, with a front-end controller, to solve all the problems, which usually doesn't work. Each problem is different, you need to guide the framework, use the correct design pattern, directly solve the problem that really want to deal with. To produce only one car, how can meet the needs of people all over the world!
Using the framework to develop embryonic system is good, but the real product is not all applied. It's easier to start from the frame, but you have to open all the frames, remove the runtime check, get rid of unwanted features, and leave only the modules you use. You don't need a generic framework, because it doesn't provide future extensibility, but it doesn't have to be written all over again, you need to be in between.
Q: How long does the site need to be drawn to expand the demand?
A: I always hate to think too much about the future. When you can't predict the future, you can't make a decision for the future.
The internet is changing so fast that I usually just draw things for six months. Deciding what to do six months from now may make a bad decision and make things worse. If you don't solve the immediate problem, but imagine the future, I don't think it's worth it, I'd rather solve the immediate problem and really focus on the products that are needed right now.
Q: So, are there any guidelines that architects can follow?
A: The main principle is to carefully consider how to allocate the module, as much as possible to disassemble the program into smaller components, adjust the appropriate API, you should be drawn to the user endpoint, such as the type of browser request? How will the application respond? Is it possible to cut? Can I assign these jobs to a completely detached server? Even on the same server, you can structure the application from the point of view of the user endpoint, and one day, when your size becomes larger, you can easily add a second server, which can be shared as long as the front-end server does not store any data. The biggest mistake for a developer is that it's too deep for the code to interact (interrelation), and each component needs to communicate with other external components, which makes it difficult to tune out the clean API. Developers will not be able to pull out of inefficient APIs into the secondary server, allowing the primary server to execute only the necessary APIs.
Q: What is the difficulty of cutting services and disassembling programs?
A: You must be aware of the problem before you start. When you finish the first version of the program before you start to disassemble the problem, it is almost impossible and difficult to deal with. It's really hard because the problem will change all the time. However, if you start with a simple architecture, and maintain this spirit to partition the module. Every time the site changes, the change of the problem will only affect a small part, you can very clear that place, can directly solve the problem. Like Lego games, cover each small block, which side still have insufficient, just need to make up a small piece of good, not to the whole change too much.
Q: In addition to the expansion, how to improve the effectiveness of the site?
A: To improve your performance, you need to know how long each program takes. I would ask, how long does it take for a user to receive the first byte of a request? Many developers don't know how long this time is (in the latency), and how much time does it take to get their code out? You can track your performance through profile and draw a visual performance flow chart to understand where the bottleneck is.
Even taking into account the latency on a single machine, the system-level tracker is known to know how long each system call to execute is consumed by the program. Also consider the delay in the browser, from the user's actual feelings of speed to improve the way the page is executed.
Every time you add a new feature to calculate how many milliseconds a new feature will add, think about what it's worth.
Q: So, what principles should be paid attention to the safety of the website?
A: The basic spirit is very simple, just use the concept of data firewall to design the site. The firewall will closely monitor every port, allowing only the packets without security concerns to pass, but the Web site developers are just the opposite, blocking out what they think is dangerous. Developers can not rely on any information obtained from the outside, the use of firewall concepts and methods, the establishment of a data firewall, will improve the security of the site.
Q: What kind of conditions does a good architect need?
A: Must be very understanding of the technology, to understand every detail, such as the design of data storage mechanism, to understand what kind of information can be stored, how many files can be stored, how much information, how fast can be put in per second? How do I copy data? What kind of data format must be used for the front end. Architects can learn how to fix Oracle database errors without being like DBAs, but to understand the capabilities of Oracle repositories. Such people are hard to find and must fail many times before they have enough experience.
Q: There are many old websites in Taiwan using PHP 4, should they upgrade to PHP 5 now? or wait for PHP 6?
A: Upgrade to PHP 5 as soon as possible. As long as some tests and modifications are made, better performance and safety can be achieved, why not? No need to wait for PHP 6, the open source community does not operate in a commitment to launch time. Many new features have been put into PHP version 5.3, and it's important to move from 4 to 5.
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.