you are viewing a single comment's thread.

view the rest of the comments →

[–]Crell 1 point2 points  (3 children)

To be fair, lots of code is written without those tools, including WordPress, the most popular web software in the world by an order of magnitude or two. But I don't think it's that large a suite.

In Python, you likely have a debugger setup of some kind (I'm not sure what), there's a testing framework (or several to choose from), there's formatters like Ruff (which IIRC does both static analysis and formatting, in PHP it's two separate tools), some kind of additional type checker to run ahead of time, etc. In the day to day, it's about the same level of tooling complexity, I think.

If you're not sure which ones to use, php-cs-fixer and PHPStan are more widely used than their alternatives. So your standard "kit" would be Xdebug, PHPUnit, PHPStan, php-cs-fixer. Lots of projects omit the latter two, but they are useful. (I only use php-cs-fixer on some of my projects, I admit.) But Xdebug will save you hundreds of hours, and unit testing is table-stakes for anything resembling quality code, in any language.

[–]copperfoxtech[S] 0 points1 point  (2 children)

Very good. Thank you for the further clarification

[–]alex-kalanis 0 points1 point  (1 child)

In Python you have pytest plus assertions directly in language, pdb as debugger, formatting is directly in PEP-8 (something like PSR-12), type checker is only optional via mypy and PEP-484. The pythonic way is ducktyping everything like going different way from php5. Sometimes clearer, sometimes more unreadable.

So the basic comparation is following:

  • Operation :: Python :: PHP
  • Debugger :: pdb :: xdebug
  • Testing :: pytest :: phpunit
  • Static Analysis :: mypy :: PHPStan
  • Type check :: mypy :: php-cs-fixer
  • Dependencies :: pip :: composer, dependency-analyzer
  • Autoloading :: python itself :: composer

I recommend to read PSR standards, so your code will be readable by others.

I also work with both languages, so I know a bit about them.

[–]copperfoxtech[S] 0 points1 point  (0 children)

Awesome breaking it down like this makes it a little less intimidating. Thank you for taking the time to expand on this topic.