Tuesday, July 5, 2016

Why PHP vs JAVA again and who rules the WEB

Sure there a are many holly-wars about wich tech is better than the other, but let me explain my point of view as a 14-year experienced programmer.

Experience with PHP 13 years, 7 of them with Java (also worked with C/C++/JS/JQ/SQL).

First of all PHP, at this time, is compiled to a byte-code with OPCache since 5.5 version, and it is even much better in PHP7.x versions whether we review processor ops speed (33% faster) or RAM (3 times less memory consumption than in 5.6 version), there was for a long time PThreads lib wich is based on POSIX C Threads supported with thread-safe versions of a PHP core.

Java - integrated Lambda expressions in 8 version, improved GC performance (as always in several JVM Generations), but it seems it is even slower time after time, convenient HTTP1.1 support, multi-threading out of the box etc makes it stuck to the market.

What I like about PHP7 - it is strong technology, really - stop thinking of it as of simple form-renderer, CMS/CRM based or even worse Joomla sites. It was 10 years ago - forget it. I`ve worked for many international companies that do their business in Russia/US/EU, Brasil, Mexico they were totally (except for some micro-services and SQL/NoSQL dbs) written in PHP 5.5, 5.6, 7.x versions and evolved faster than projects on other techs. In other companies, the core+API-calls were written in PHP successfully.

As for the last trends in PHP world, there are primitive types (scalar types with type casting) You can do (int), (double), (bool), (string) in any version since 5.x, return type declarations in methods/functions, scalar type declarations in arguments of a method/function, SPL. And as always does - PHP community strongly supports Web protocols, formats.

Java is more like enterprise and it may seem to  have things done, but it is not always completely true and what is worse - it is much more difficult than in PHP wich is adopted by static-call functions written in C and closely integrated with Linux functions and tools. Ex.: if U need to delete the file, in PHP U just do unlink($myFile); wich is pure, native and intuitive - sure there are many examples like this - fork(), fread(), fclose() etc

FrameWorks: everybody misunderstanding that there are 2 great FWs for Java Struts and SpringMVC, may be for the last few years Spark and none of enterprise - production ready FWs for PHP - Nah, totally not a true as with other statements of shallow unprofessional individuals, who can not see beyond their noses in some directions. Proof - there were a long time ZendFW, for those who like MIT license - numerous Symphony, Yii1/2, Laravel5.x, CMS based Drupal and much more, they are really stable, enterprise and production ready.

Nowadays PHP is the world's biggest and commonly used tech for Web, API, RESTfull services, micro-services, it strongly supports all the RFC recommendations.

PHP is 21 years old monster in 2016 - it can not be underestimated.

Thx for reading,
Sincerely Yours, Arthur.