About the experience of Web front-end separation

Source: Internet
Author: User
Tags smarty template

Because the company has a special project, previously was completely PHP (Smarty) written a program, now to turn to Php+node. So inadvertently to the back end of the students instilled in the next with node to do the separation of the idea of the front and back.

I have previously answered such questions on the understanding. Probably as follows
http://www.zhihu.com/question/26835139

The experience is more profound as angular projects are currently being done.

Now let's take a look at the idea of separating back and forth, or a little bit of reference http://ued.taobao.org/blog/2014/04/full-stack-development-with-nodejs/

1. The first generation of Web programs I contacted

Why is 我所接触 that? In Java. I might have used ejbs before, but I heard it was huge.
The first generation I contacted should be Jsp+servlet, which was basically the way to parse the JSP into a servlet and then tomcat to translate the servlet into the corresponding HTML and publish it. Page and page before completely through the servlet communication, contact is not too much, not too deep.
Just at that time in the JSP write Java code, even write data operation code, there is no separation of thought. The entire code looks bloated.

2. Spring era

The separation of the slightly obvious is the arrival of spring, then there are three layers of architecture, do not mention what those caches, Dao+service+web,dao provides the underlying data support, service write business logic, the WEB provides pages. It is a classic practice to plug a string of data into a request or session, and then write Java code in the JSP or write a template language such as Jstl. This often back-end students also have to write a demo page for testing (that can not write the demo really not?) ), while the front-end students can leisurely leisurely cut some pages, brush a bit to know, write a will css-> brush a will know. After the end of the students to write the service, the front-end students then cut the page to the back end. Back end classmate one by one pits again.

This may just be our graduation design approach, and there may not be a real front-end engineer, only Php/java engineer +ui and so on.

3. Rest times

At this point the SOAP protocol seems to have not seen much, at least I did not see much.

This kind of way still works well, the front and back of each side. This time后端It is OK to simply provide the purest data service, and the data exchange is generally done with JSON. And this time the front end will usually use node as the front-end server, of course, you can not. Then the problem naturally comes, the data exchange between the front and back is a particularly important link, including the front and back of the students to set数据格式同步session错误监控Wait a minute.

In fact, this is still the way back-end template. Just before PHP's smarty template, Java's jstl expression, now become node in the EST and so on. But this separation method in subdivision work , Improved the development efficiency of the and other aspects played a key role. There is a need to be more sophisticated about performance improvements.

By monitoring the error of the interface, it is easy to find the backend service unstable. The current API monitoring, very pure, although not perfect, but still found a lot of problems.

4. The front-end MVC era

Now we're using angular. This will completely discard the node layer template, which should be the second generation separated. Angular still in the study, I really fancy Two-way binding this artifact, Google another great invention.
issues that are currently in existence:

    • Permission control, previously only used through the URL, the backend can be controlled, now is the hash value, how to control the backend?
http://hirra.cn

About the experience of Web front-end separation

Related Article

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.