質問

I'm at the pre-release stage of an open-source PHP project, one which I hope will be used by other developers in their own projects. The project doesn't currently support namespaces and I'm trying to evaluate if it should use namespaces or the PEAR naming convention of Dir_Subdir_Class, which seems to have all of the same technical benefits without some of the drawbacks. To be honest, it's not an easy choice.

Some points of consideration against namespaces:

  • One of the ways that my project is trying to differentiate itself by providing a simpler API than other similar projects. Because namespaces are new and also because they are more complicated than the PEAR naming convention, introducing them into the codebase will make my project less simple to use. By implementing them, I lose some differentiation in terms of ease-of-use.
  • While I can see some benefits to namespaces, they don't seem to solve a problem that needs to be solved in a modern PHP product that uses the PEAR naming convention. Naming conflicts while using my project should be minimal if not non-existent.
  • This article gives me some pause in adopting namespaces as their implementation has been less than stellar.
  • I'm also hesitant to jump on a bandwagon that may not go anywhere. As namespaces are a new feature to PHP, I'm not convinced yet that they will become standard.
  • Compatibility. Almost all of the PHP code that has ever been written does not use namespaces as it's a new feature. Other libraries would be incompatible without a conversion.

Some points for using namespaces:

  • Perception. If namespaces become standard and a best-practice, my project could quickly become viewed as unprofessional and obsolete without them.
  • Competition. While some competing PHP projects are beginning to use namespaces in their latest versions, many have yet to make the leap. Doing so now could give my project a leg-up on other projects.
  • Future work would be easier if I made the switch now before the project goes public rather than after, where I would have to support two versions of it for a while.
  • I want to support best-practices and if namespaces become a best practice for PHP, my project should make use of them.

From what I can tell, you must choose one way or the other; you can't do both. Are there any points that I haven't considered? Are there any objective signs (no flamewars, please) that point toward or against namespaces becoming the professional standard for PHP? I would appreciate any insight or resources that you would be willing to share as I need to make a decision soon.

正しい解決策はありません

ライセンス: CC-BY-SA帰属
所属していません softwareengineering.stackexchange
scroll top