WordPress is used for a long time, but the underlying code is not much contact. Do not know how to evaluate the master with Joomla and Drupal ratio, single from the quality, WordPress at what level?
Reply content:
I am the old user of WordPress for many years, starting from WordPress 1.5 to use, to WordPress 2.3 began to appear major reform, later gradually WordPress 3.x,4.x, I still adhere to the use of WordPress, and, Also because from the 2.0 era, in-depth study of WordPress code, I became a PHP programmer.
Now, I am a PHP programmer who has worked for 5 years, and I think I should answer that question.
Code quality, these four words, we first discuss their connotation and extension, if the concept is unclear, I think we can not evaluate. What do you think about the quality of the code that you see here?
- High cohesion
- Low coupling
- Readability
- Maintainability
- Testability
- Layered
- Abstract
- DRY
- Object oriented
- Design Patterns
Don't you know I said it all? Anyway, I can't say it all, there are a lot more ... If so to evaluate this project, I can only say, WordPress code is still pretty rotten ~
However, if we look at the WordPress story, I believe you have different views. First, we look at the era of WordPress, WordPress well-known author Matt, is a 1984 stranger, he in January 2003, began to write WordPress, at that time, because he used a program called B2/cafelog, feel uncomfortable, I want to enable it to support modern web standards before launching this project, which is based on the Cafelog code to start rewriting. So, WordPress is not built from the 0, itself is standing on the shoulders of giants, but this giant, basically hung old (even the concept of web standards are not).
Look at that era, first of all, Matt, a freshman at the University of Houston's Department of Political Science, then he was a saxophone musician who liked music, photography and travel, so he was a rookie in programming ... He was only 19 years old. So it's no surprise that he can't even make it happen, and it turns out that WordPress is the most famous blog program in the world, and he's still very talented, he's got it, and, look what he's doing this for, he needs a blogging program that satisfies his requirements and conforms to web standards, and he does!
What about the external environment at that time? When it comes to WordPress, it's impossible not to mention php,php at the time, but I'm sorry to tell you that PHP has been a great success, From the beginning of the php4.x, and PHP as a heavily criticized language, from the beginning there is no object-oriented concept, just to solve the web development and design of a language only, it was not expected to use PHP to do great software, just want to do a home page. Support for the object-oriented PHP 5.x, was first release in July 2004, and at that time, PHP 4.x has been a very big success, and has been successful for many years, so many software is too late to migrate to 5.x.
So, everyone think about it, with the most rotten PHP language (not support object-oriented), with the process-oriented programming paradigm, wrote a can run blog, and fully functional, deployment is simple, installation smooth, few bugs, you say the code quality how ah? Don't ask me, I don't know.
I until the 2.x, the ability to gradually be able to concentrate on the code, WordPress inside a lot of ideas or very good sparkle. For example, it's action and hook mechanism. This thing, say how mysterious, not a bit. This is not a observer design pattern, so naturally in the inside, to solve the problem ah, and is the process of implementation of the Observer Oh! Plug-in mechanism, is not a dependency injection. There are priority queues, too! Deal with category there, recursion, the structure of the tree, algorithm also leverage AH. Again see 2.3, the introduction of the tag, information retrieval thinking is also a lever, ah, the idea of tag than the tree-like category directory, has been direct to the modern AH.
WordPress Another great place is evolution, from PHP 4.x to evolve to PHP 5.x, and then it is a long time to support both PHP 4.x and PHP 5.x syntax, I want to say, PHP 4 developed into the late, there is an object-oriented, but very humble, Even access control is not ah, but WordPress has been supporting two generations of language grammar Ah! has been considered a lot of personal bloggers using virtual host, not easy to upgrade the system, as far as possible to let them use a better version ah.
After the history of the wheel into PHP 5.x, inside one after another module, in a iteration inside, gradually object-oriented. The Widget's class version appears, first ending with a piece of process-oriented approach to writing widgets. Later, more and more internal modules are gradually becoming object-oriented. In the implementation of this process, all with the old version of the plug-in development, all continue to use, WordPress backwards compatibility, not only across a variety of minor version number, but also across the major version number is not good. I wrote some plugins in 2.x, and now I can continue to use them!
I was tired to express my feelings.
WordPress from the Code aesthetic view, still not what beautiful works. Inside the code dirty, disorderly, various trick, performance and logic mixed, coupling and so on, the numerous.
But from the user-oriented point of view of the code quality, WordPress can no doubt be ranked in the world's best software directory inside.
- Easy to deploy, less dependent, basic not dependent on various extensions;
- Backwards compatibility, compatible machines (*nix, win), compatible interpreters (PHP 4.x, 5.x), compatible databases (MYSQL,POSTGRESQL), compatible communities (plugins, older versions of skins)
- Interface fashion, design trends, follow the footsteps of the Times
- Features are simple and easy to use with few bugs
- The security basically conforms to the small and Medium website request
- Performance is basically in line with small and medium site requirements
Therefore, WordPress is a good quality project, and has been adhering to the spirit of user-oriented, its users are not only blogging bloggers, but also thousands of people rely on WordPress to earn income from freelance programmers, WordPress did not rough request they constantly upgrade plug-ins, The version of the skin to follow the version (such as the evil apples), there is no rude prohibition of the use of the old version, but the very best compatible with everything.
So, until today, WordPress is still a very popular blog system, and has gradually upgraded to a small CMS system, and its open architecture, Hook idea, can let people change it into a variety of things, someone did the shop, also someone did the community, can not AH.
If you sink your heart, carefully study the code, not only aesthetic, but also consider historical factors, realistic factors, not only study a version, but also study the new version, research code Evolution, I believe that can learn a lot of things, perhaps learn this, can not become a great programmer, but you may become a good product manager, Learn how to respect the user, how to go all to the user value for the purposes of, can also become an excellent engineer, learn how to make a piece of ugly code, continue to better direction, keep up with the trend of the times and script, rather than let it rot and stink. If you have not seen Core/plugin architecture system, you will say WordPress ugly; If you have seen some core/plugin architecture systems, Emacs, Vim,drupal,joomla various CMS, you will find WP is the simplest of these "elegant" Read a book do not hold the "coupling high" relationship serve, you should first think about the architecture of Core/plugin and the cost of low coupling in this architecture, and, conversely, think Core+plugin itself is not the largest low coupling? are process-oriented programming, since the beginning of the object-oriented, life is clear a lot of hooks
Hook
Hooks ~ There is a simple way to judge code quality without looking at the code:
1. If the underlying code is widely used and has a long time, then the code quality performance and stability are guaranteed;
2. If the application code is widely used and has a long time, then the code architecture must be backward and coupled seriously; ugly cry Some people say that WordPress code is like poetry.
I think, he must be a certain word pronunciation wrong ... Flexible, poor performance, suitable for small sites.
Website traffic a bit more needs depth optimization, sub-table what is quite annoying and messy, everywhere are strong coupling, chimneys lined. Do not see the bird Brother Test PHP performance are used WordPress ...
The first time to look at the source code does feel that the process is too tiring, but can put such a source to see once, their ability should be improved a lot