What are the advantages of ThinkPHP and Django frameworks? ignore the language itself? -Php Tutorial

Source: Internet
Author: User
Help with usability and scalability analysis to help with usability and Scalability Analysis reply content: you asked ThinkPHP if it is not suitable (no foundation) to quickly get a job, no problem; you asked ThinkPHP "OK ", that's all. In comparison with Django, some people think ThinkPHP is good. I really want to say something-technically, ThinkPHP cannot match Django in any way.

ThinkPHP code quality is very general, especially bad style-a large number of single-letter naming, global functions, global variables (and combinations-single-letter global functions), abuse of GET/POST arrays ...... For example, if a single-letter key is used in the form (for the purpose of obfuscation or URL compression), the result is inexplicable, it turns out to be one of the default global GET parameters of the framework ...... The most important thing is that these are the characteristics they are proud! This is all the public interfaces exposed to developers, inside the framework, let alone the technology of "shrinking" can be seen everywhere, there is no unified code specification, and the pitfalls caused by PHP type conversion are not avoided ......

Security is also worrying. Not to mention the detailed vulnerabilities caused by the encoding quality, the entire SQL query builder design is simply chilling! I didn't pay attention to it at the earliest. I also thought that as a modern framework (ThinkPHP 3.X), using prepared statement and parameterized query should be basic, if possible, you should also bind the type (especially in dynamic languages). however ...... Until I saw ThinkPHP's SQL injection vulnerability in the dark clouds one after another (now there should be a lot of public details, you can search for it by yourself ), after a regression was repaired, it even indirectly led to a new regression. I thought how easy a framework was to be injected. I took a look at the patches that were fixed and the entire SQL subsystem, scared me ...... There have even been official responses similar to those designed in this way and developers should respond on their own-this is often true, but I don't feel like passing any value Query builder(And there is no mandatory use of functions such as "unsafe") leading to injection issues that developers should address ......

Speaking of regression, we have to mention the most critical point-where is the test? I am afraid to use a framework that is so large but has no unit test ...... (Knuth's TeX has been tested ...... It is not the "master" in the Zen of programming "......)

Another question that can be discussed is upgrade. I have done ThinkPHP 1.X to 2.X and then 3.X. The interface, behavior, and even the entire structure and model will change. remember that the upgrade document is a thick PDF, and many details are not completely covered. In comparison with Django, even in the early days when Django was greatly changed, it was not as painful as Upgrading. In most cases, several versions of Django would be given early warnings to deprecated ...... Not to mention that Django's recent upgrades have been smooth for a long time, which is also related to its reasonable architecture. Of course, you can also support such disruptive upgrades, provided that you are willing to take the time to follow up on the major version, otherwise, there will always be no security support in the end of the old version-see how many ThinkPHP websites of the old version are used by script kiddies now?

ThinkPHP also has "advantages". from top to bottom, all Chinese characters-comments, commit message, documentation, community ...... There is almost no English sentence (of course, no code is left aside), and there is no desire for it, clearing the obstacle of learning English.

In my opinion, it is only for historical reasons (although in this case I strongly suggest changing jobs) or to speed up technical training. In other cases, do not touch this big pitfall. Discussing the advantages and disadvantages of frameworks is also more meaningful for vs Django such as Laravel and Symfony.

Update (a.k. a. off-topic ):
Many people have mentioned CodeIgniter, which is also the first framework I have used. it is also a PHP framework with the highest proportion of code I have read. CodeIgniter's design, architecture, and code quality are both good and easy to understand. However, no matter how CodeIgniter is positioned and ThinkPHP is completely different, it is a lightweight framework. one of the most important differences is that the data layer abstraction is very simple. Unfortunately, its development has been stuck for a long time, especially after PHP 5.3 (not only does not use new features, but also has compatibility issues )...... CodeIgniter of 2.x is not recommended in new projects (there are too many important new features after PHP 5.3 ). As for the maintenance of a college (BCIT) that CodeIgniter transferred to me some time ago, it launched version 3.x. if it has not been used, it will not be commented on.

Another framework that I once liked was CakePHP. it has code specifications, complete testing, and active teams. I like its data models very much. It is a few PHP frameworks that have done a good job in ORM, the debugging function is also very powerful. In addition, the "scaffolding" function, such as automatically generated code and database, can be said to be closer to Django. However, it is a pity that the implementation of my favorite data model in 2.x has problems-heavy historical burdens and overly complicated logic, it causes bugs in extreme cases (such as complex layers and links) and is difficult to fix. I spent time investigating bugs, trying to fix them, and discussed them with the CakePHP team, finally, it is difficult to completely fix the problem without compromising compatibility. Therefore, the entire data model system is refactored in version 3.x. Now 3.0 seems to have come out, but I still haven't used it ......

Laravel is too new and Symfony is too heavy, so I have never used the two. Yaf is completely different. The difference between a tractor and a car ..

The development environment of many projects in China is farmland... the following data time point is 20150818.

Search on github Search on github
Thinkphp Thinkphp

There is no comparability at all. think php does not support pdo (SQL Injection risks) and namespace. it is said that the new version has been changed. at this follow-up speed, i'm not talking about it anymore. laravel float the PHP Framework. YII is the most widely used in China. ignore the language itself. are you talking about P? Many features of the framework are based on language features. ThinkPHP has stopped updating, so people who like ThinkPHP should change http://asp.net early Right ~

Many people in China like to use ThinkPHP or PHPWind, something outdated hundreds of years ago. this is not good. when selecting a framework for the project team, you must find a framework maintained by someone, why don't anyone bother to raise a pull request on GitHub ~

Django is also a good framework. it is suitable for beginners. I have never used TP, but in terms of my experience in using TP and yii2 .. I don't like TP.
= I can see the global function M function D function in TP, which is disgusting (I am an object-oriented thinker). isn't PHP the best language? I only want to say that TP is very fast, 1 Morning

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.