4 ms·
> Python is not suitable for complex multi-layered systems But PHP is? I cannot imagine a "complex multi-layered system" for which PHP is a better solution tha
by kstrauser 6y ago
> Python is not suitable for complex multi-layered systems
But PHP is? I cannot imagine a "complex multi-layered system" for which PHP is a better solution than a Python stack.
- SergeAx 6y agoPHP has (almost) complete strong typing system and all the bells and whistles of OOP needed to implement said systems using proper patterns and methodologies and make it modular and testable enough to be robust and supportable for a long time.
- kstrauser 6y agoPython has literally all of those things, and has been strongly (but dynamically) type from the very beginning. PHP is still weakly typed today. This code doesn't raise a warning or anything: $ php --version PHP 7.3.11 (cli) (built: Jun 5 2020 23:50:40) ( NTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.3.11, Copyright (c) 1998-2018 Zend Technologies $ php -r 'echo "123" + 45;' 168 Contrast with Python: Python 3.8.3 (default, Jun 1 2020, 10:55:34) >>> "123" + 45 Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: can only concatenate str (not "int") to str
- SergeAx 6y agoThese examples are not about strong typing, but about type juggling. Strong typing is this: declare(strict_types=1); use \Domain\SomeItem; use \Domain\SomeItemId; use \Domain\SomeItemSpec; abstract class SomeItemRepo { public function GetOneByID(SomeItemId $id): SomeItem; /* * Still hacky * * @param []SomeItemSpec $specs * * @return []SomeItem */ public function GetManyBySpecs(array $specs): array; }
- kstrauser 6y agoThat's an example of strong typing specific to PHP, then, and not used in the rest of computer science. What you're describing there is usually known as static typing, which Python also supports.
- francislavoie 6y agoNo, types are checked at runtime in PHP. You can also use static types with docblocks and use static analysis tools, and both play complement eachother.