In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article is to share with you about 9 popular Web frameworks and their advantages and disadvantages. The editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article.
For Web developers, finding the right tools can make your job a lot easier. Among them, the Web framework is a "sharp weapon" to improve work efficiency. But because there are so many Web frameworks to choose from, how to choose is also a headache.
The editor lists 9 popular Web frameworks and analyzes their advantages and disadvantages.
What is the Web framework?
When Web browsers use HTTP to communicate with servers (computers) running elsewhere, these servers receive some notifications:
Selected URL
How to enter a URL (submit through a form or just enter a URL in the browser bar)
The server does a lot of things, such as:
Read and add data in the database
Find the correct result (is the user allowed to view the page you are trying to visit? Do you want to send to a different URL? Etc.)
Build the web page that the user will see
If you want to provide more complex functionality, you need to perform more steps. As a developer, you need to list a series of solutions for the features you want. The Web framework is one of the alternative solutions.
Get to the point:
1 、 Ruby on Rails
Programming language: Ruby
Brief introduction:
Ruby on Rails is a Web framework that has been adopted by many companies, is the ancestor of the Web framework in the Ruby programming language, and has been adopted by a large number of developers. DHH (the founder of Rails) used it to create a blog in about 15 minutes.
One of the major features of Rails is that convention is superior to configuration (convention over configuration). This means that it is more stylized, standardized and "prescriptive", and developers usually do the same thing to keep the code to a minimum.
Rails also uses MVC (Model-View-Controller) to make the architecture more organized and thorough.
Advantages:
Rails has a powerful command line interface that can start and run on new applications with a few simple commands.
Rails has been around for a long time and is widely used, and there are many tutorials about it on the Internet.
Rails is easy to use, and even complex problems can be solved relatively quickly.
Disadvantages:
Rails automatically hooks a lot of things. There are a lot of files in the launcher, and a considerable amount of configuration code is written automatically, which some people may worry about.
Overall, in view of its flexibility and convenience, Rails is an ideal Web framework for beginners to give priority to learning.
2 、 Sinatra
Programming language: Ruby
Brief introduction:
The above five lines of code is all the code needed to make an empty Web application with limited configuration, and if you compare it with Ruby on Rails, you will find that it requires less code (and only one file, not dozens).
However, the simplicity of Sinatra is a double-edged sword. It uses the opposite approach to Ruby on Rails and requires developers to configure everything manually.
Advantages:
Sinatra is the leader in lightweight frameworks.
Sinatra is highly configurable and pays attention to the freedom of development.
Disadvantages:
Because it does not focus on "conventions" and does not have the same folder structure, it will be difficult to understand existing Sinatra applications.
Sinatra is not often used in actual production projects.
Manually configuring a lot of things often takes more time, and efficiency will be affected.
3 、 ExpressJS
Programming language: JavaScript
Brief introduction:
ExpressJS is a JavaScript Web framework based on Node.js. Whether it looks familiar or not, its code is very similar to Sinatra's code and has the same simplicity as Sinatra. There are only two code files in a quasi-Express application:
Package.json, this is the file automatically generated by NPM.
App.js, which contains the complete code for the application.
Advantages:
High flexibility.
You can use only one programming language.
Lightweight.
Disadvantages:
More options = more choices. Choosing means studying different options and figuring out how to apply them to your own projects, which often takes more time.
4 、 SailsJS
Programming language: Javascript
Brief introduction:
SailsJS can be thought of as a JavaScript version of Rails, with a command-line tool to generate a complete default application with many reasonable default configurations and values.
Similarly, Sails also has a MVC architecture, and dozens of default files will be available to launch a complete application.
Advantages:
There are many default configured ways to do most of the work involved in building Web applications.
Command-line programs make it easier to build new applications and functions.
Disadvantages:
Although it is a framework that looks powerful and popular, not many companies adopt it.
5. MEAN stack
Programming language: JavaScript
Brief introduction:
MEAN is an extension of ExpressJS, stacking technologies such as MongoDB, AngularJS, and WebPack. MEAN uses JavaScript to drive the whole application.
MongoDB is a database that is conceptually different from most other databases. It allows JSON data to be free and random in it, which means that database entries are flexible, but at the same time, invalid records become a very easy problem. Instead of interacting with the database through SQL, it uses its unique JavaScript.
Advantages:
Like SailsJS, the MEAN stack contains all the components needed to build complex Web applications.
Disadvantages:
It takes two stages to load a page, and the * phase looks a little funny. This happens because the view is not rendered on the server side, but only in the browser. This means that what the user initially sees is an incomplete page, and the complete contents of the page will take a while to load.
The MEAN stack contains many technologies, such as MongoDB, that are not usually used when building Web applications in other frameworks.
Add a few personal views:
This framework that includes MongoDB makes no sense to me, and almost all other Web frameworks use the standard database SQL. In my opinion, the MEAN stack may only be valuable in scenarios where MongoDB is really "glowing", but Mongo is also something you need when there is a high load, such as ad networks and API.
There is no denying that MEAN makes sense in some cases, but for typical Web applications, I do not recommend it. Because MEAN uses only the JavaScript programming language in every part of the application, this sounds easy to grasp, but things like MongoDB and WebPack make MEAN actually more difficult than the "standard" technology that solves the problem.
6 、 Django
Programming language: Python
Brief introduction:
Django is a MVC Web framework that runs on Python. It also has some ready-to-use configurations, and it has many similarities and differences with the Ruby on Rails framework. This Web framework changes the responsibilities of controllers and views, but there is no doubt that it is an excellent Web framework.
Advantages:
Light weight and less configuration.
Provides a complete development stack while still following the design philosophy of Python's "clear" language, allowing a balance between rapid development and long-term maintenance.
Note:
Python is a language similar to Ruby, but its users have different domain tendencies, and developers who use Python tend to work in the field of data science, statistics, or analysis.
7 、 Tornado
Programming language: Python
Brief introduction:
Tornado is a little-publicized Python Web framework that is fast, efficient, and allows developers to access python's large database.
Advantages:
It is excellent in cases where many requests occur in a short period of time.
Disadvantages:
The lack of structure leads to different applications.
For beginners, having too much freedom can lead to garbled codes. Developers who have experience in other frameworks are more likely to build applications in a thoughtful way.
8 、 Play
Programming language: Java or Scala
Brief introduction:
Play is also a lightweight, stateless Web framework that learns the advantages of rails and uses a fully asynchronous model built on Akka to provide predictable and minimal resource consumption (CPU, memory, threads).
Advantages:
Running on a Java virtual machine, Play is one of the most efficient programming environments.
Disadvantages:
Most Web applications are built in so-called "scripting languages" that allow you to quickly change the visual effects of the page. Java adds a step called "compile" that needs to be done between applied changes.
9 、 Laravel
Programming language: PHP
Brief introduction:
Laravel is a framework written in PHP. Ten years ago, PHP was the standard programming language for almost all Web applications, but today, under the influence of Ruby, JavaScript, and Python, PHP has lost a lot of market share.
Still, Laravel is a very mature framework that allows you to build beautiful code using PHP.
Advantages:
Laravel is a very MVC framework that draws on many of the architectural decisions used in the Ruby on Rails framework.
Disadvantages:
The number of developers and products using PHP is decreasing (the original text says ^ _ ^)
* tell me more.
After looking at these different frameworks listed above, it is easy to find that they are looking for inspiration for each other, and many functions and features are actually quite similar. Therefore, it doesn't make any sense to say which is good and which is not. Finding what is right for you is the key. The above framework can be simply divided into two types:
I. simple framework
ExpressJS, Tornado, and Sinatra are all minimalist frameworks that provide the * configuration required for startup.
These frameworks require developers to manually add each individual component, giving sufficient freedom to complete the project. In addition, by forcing yourself to configure all aspects of the application, you can take more initiative and use the ideal tool in each case.
Of course, there are some shortcomings. You will often find yourself in a situation where you need to analyze different options and make a lot of choices.
II. Omakase framework
Rails, SailsJS, MEAN.io, Laravel, and Play are all Omakase frameworks that advise developers to write code in a "correct" way and give community standards.
These frameworks provide everything you need for development and can be programmed by opening them. They also allow you to choose to deactivate if you want to use something else. The developers who built these frameworks have made some key decisions for the newcomers, so they can follow the patterns they recommend.
This has a great advantage for beginners. When beginners learn the Web framework, you also need to learn about databases, HTTP requests, setting applications to run on Internet, and so on. Because of a widely accepted community standard, learning a Web framework like Rails can:
Learn how the community agrees to do something in the right way.
Have time to think about other programming concepts and learn other knowledge.
Once you have learned the advice of one framework community, you will have experience to better evaluate other frameworks.
These are the nine popular Web frameworks and their advantages and disadvantages. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.