Thoughts on front-end framework and front-end class library in Web Development

Source: Internet
Author: User

Thoughts on front-end framework and front-end class library in Web Development

This article mainly introduces some ideas about front-end frameworks and front-end class libraries in Web development, this article explains the misunderstanding of the front-end framework, the difference between the front-end framework and the front-end class library, and the front-end MVC Framework ideas. For more information, see

Speaking of front-end frameworks, I am also drunk. Now I am going to interview or chat with my colleagues. I can't move on to this frame. The frame is sharp.

Of course, it's not about debelating the framework. It's just about a sense of cool. The website technology exists for the business. The framework is also meaningless. In terms of Technology Selection and architecture design, the pursuit of fashionable new technologies without the actual website business development may be counterproductive, and the website development may be introduced into the rugged path. It is like a small e-commerce website with only a few hundred PVS per day, but it wants to shout "this is what a treasure is doing" and then build an application server cluster, use a distributed file system and a distributed database system... and a bunch of other methods that barabara uses to handle high concurrency and massive data access. I want to say, is it meaningful?

  Misunderstanding of front-end framework

The value of a website lies in what value it can provide to users, what the website can do, and not in how it does it, therefore, when the website is still very small, it is worth the candle to pursue the website architecture framework. The same applies to front-end frameworks. For a simple page-based product, applications only rely on servers to generate Web pages and views, in addition, you only need to use some simple Javascript or JQuery to make the application more interactive, so a JQuery front-end class library is enough, and there is really no need to use some tall frameworks.

Of course, the framework is indeed very useful, and the focus is to know when to use the framework. The experience and success model of large companies and large projects are of course important and worth learning from, but we cannot become blind. Only by deeply understanding the front-end framework and knowing when to use the Framework to solve the problems can we be targeted and hit the key.

  Difference between front-end framework and front-end class library

Before using a framework, I think it is very important to find out the differences between a class library (such as JQuery) and a framework (such as angularJS.

In short, the class library solves code or module-level multiplexing or complexity encapsulation problems. For example, it encapsulates a functional module that solves a complex problem into a function, provides a simple interface. Library is a tool that provides a lot of encapsulated methods. It doesn't depend on ourselves, that is, it doesn't affect our code structure.

The framework is more about the reuse of the pattern level and the specification of the program organization. The pattern here refers to MVC. In order to realize the decoupling of M and V, the complicated coupling relationship is transferred from the frequently changing business code to the infrequently changing framework for digestion. It provides a set of solutions for a single domain to improve development efficiency. If we choose to use a framework, we should follow the rules stipulated by the framework.

The main difference between the two is that JQuery is centered on DOM operations, and the framework, which is precisely the MVC Framework, is centered on models, while DOM operations are appended. Therefore, the model-centric goal is to bring about a complete set of workflow changes, so that background engineers can compile the front-end model code to interconnect the background with the front-end, the interaction designer processes the interaction between the UI and the model. The UI Designer can focus on and process the HTML source code without barriers and submit them to the interaction engineer in the form of an Interface Template. This complete collaboration mechanism can greatly improve development efficiency. Use the MVC framework to better decouple front-end tasks.

  Front-end MVC Framework

We know that the traditional MVC model divides an application into model, view, and controller ). They have different roles in the application system to complete different tasks.

Model: A data Model used to encapsulate or process data related to the application's business logic. The Model can directly access data.

View: A View is used to display data for a purpose. Generally, there is no program logic in the View. To achieve the latest functions on the View, the View needs to access the data model it monitors.

Controller: the Controller controls the connection between a model and a view. It controls the application process, processes events, and responds. events include not only user behavior, but also changes in the data model. By capturing user events, the model layer is notified to make corresponding updates, and updates and changes at the model layer are notified to the view to make corresponding changes. Therefore, the Controller ensures the consistency between views and models.

My understanding of the front-end View is that the content directly related to the elements on the page belongs to the View. Including html, CSS, and JS that directly controls page elements. You can get the data from the Model and display it to the page. All data changes and requests are handled by the Controller.

What about Controller? As the binder for Model and View, the Controller forwards View requests to the appropriate Model and updates the View if necessary. The Controller can also act as the Model observer to obtain Model changes. As a Controller, there should be no code involving page elements.

Finally, let's talk about the Model. Communication with the backend, AJAX requests, and data processing all belong to the work of the Model. The Model itself does not know who is the View and who is the Controller. It only provides some methods for the View and Controller to call, and notifies its observer View or Controller of the change. Obviously, the Model and page elements are also decoupled.

Although there are many differences between the frameworks based on the MVC Model, in general, the Model is responsible for saving the data and data processing logic required by vier, such as reading and writing, updating, deleting, verification, and conversion. View is responsible for receiving and displaying the data provided by the Model and receiving user input, and responding to the event. After the Model is updated, the update is promptly fed back to the user. The Controller processes business logic and Event Logic.

  Know yourself and know the right medicine

As front-end frameworks and class libraries become increasingly abundant today. It is especially important to select a correct framework or class library. I don't think it is necessary to follow the trend blindly. When I see any framework fire, I just ran around for a week, and then I couldn't use it because of my project work, A few months later, I forgot everything.

Therefore, I think it is important to lay a solid foundation and focus on understanding the roles of various class libraries and frameworks. What problems does a framework focus on, it is best to study the API when the project needs to be used.

Finally, we need to understand the limitations of MVC in front-end development. If a simple project uses the MVC Framework, the project may become more complex. Of course, with the increasing complexity of the Web Front-end and the constant development of the front-end MVC framework, I believe that in the future application software complex products, the MVC Framework will certainly bring a leap in front-end work efficiency.

The above is just a simple understanding of the front-end framework and class libraries. I hope you can better learn the framework and class libraries. Make progress and learn together.

If there are technical errors in this article, please correct them. It is a sin to mistake the children.

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.