Decoupling in front-end development

I saw a question on Zhihu: " How can I know my programming level? ".

 

The answer from the number one mu peng is:

 

Look at the needs.

If the requirements change a little, your own code will have to be overturned, which means that you still need to work hard.

If the demand has changed a lot, the customer and the PM will feel very embarrassed, and they will agree. But it took half a day to go back and the changes were completed, and there were basically no bugs in the test. This shows that the level is good.

Thank you.

 

It is very helpful to see this answer. So I thought of my own front-end development work.

 

I think that in development, decoupling must be done well, because, as mentioned above, customers may continue to put forward requirements, and you have to constantly change the page. If you do the decoupling work well, it will be less painful to change.

 

In my work, I use two kinds of decoupling, one is code decoupling, and the second is business decoupling.

  • Code decoupling . Front-end development knows: decoupling between content (HTML), presentation (CSS), and behavior (JavaScript). For a detailed introduction to this place, please refer to "Writing maintainable JavaScript" , which is very detailed.
  • Business decoupling . When making new requirements for customers, if you see an existing page that is similar to it, you can't use this page just because you think about reuse, so when customers put forward new requirements, it may affect other businesses , so business decoupling is required, and different businesses cannot be directly affected.

Blogs may be added at any time to enrich the content, by the way, I despise the ads below, I can't stand it.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326413739&siteId=291194637