Why is namespace rarely used in PHP projects?

Source: Internet
Author: User
I have read several open-source systems and have not used namespace. What are the main reasons? I have read several open-source systems and have not used namespace. What are the main reasons? Reply: 1 although I have been talking about it for many years, it takes a short time to get things out.
2 In PHP, these elements are not mandatory and there is no reason to use them.
3. if namespace is used at a required level, the question may not be appropriate. This expansion is complicated, so the answer to the previous two prevails. this is a chicken rib for two-to-one purchases.

Namespace is now widely used. namespace is also used by many open-source software on github, and namespace is used by some NB open-source frameworks, such as Symfony and larvael, using namespace can easily manage the conflicts between autoloader and class naming. the valuable reason is that it is flexible enough. Currently, php namespaces are not flexible enough. 1. the company's projects are all developed based on a lower version and switched to a higher version, which will inevitably produce bugs (cost)
2. open-source applications are considering compatibility with more virtual hosts (market)
3. the main reason is that there is no need to use it in the project (advantage)
To sum up, the cost is high and the market supports little. there is no obvious advantage, mainly because PHP 5.3 has not yet been popularized. However, I have applied it in the actual project. Namespace is supported only when PHP is above 5.3
In other words, it is a namespace, that is, object-oriented objects are not necessarily used by projects. for some small projects, they cannot be used.
When talking about open-source systems, most of them will consider backward compatibility. for example, many virtual hosts are php 5.2

Compatibility is too bad!
No namespace available, not compatible!
Class libraries with namespaces cannot call class libraries without namespaces! It will become more popular and easy to use! I would also like to add that in fact, namespace came out too late. However, if a larger framework has encountered a problem that needs to be solved by namespace, a more complex class name is used, the use of namespace is not urgent. In addition, the development scale of php projects is generally insufficient. our domestic php development environment also pays little attention to technical development.

Of course, the technology will inevitably make progress. there is no failure in the design of a widely accepted concept in other programming fields such as namespace. the popularization of applications is only a matter of time. 5.3 is supported. How long has it been released? How many projects do they start after 5.3? New features must be used only when you are familiar with them.

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.