PHP Classes

php, really ?

Recommend this page to a friend!

      PHP Classes blog  >  26 Ways to Show that ...  >  All threads  >  php, really ?  >  (Un) Subscribe thread alerts  
Subject:php, really ?
Summary:php, really ?
Messages:6
Author:gino pilotino
Date:2013-03-21 17:37:32
Update:2013-03-22 04:36:22
 

  1. php, really ?   Reply   Report abuse  
Picture of gino pilotino gino pilotino - 2013-03-21 17:43:08
this should have been entitled "how to turn php into java" :)

  2. Re: php, really ?   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2013-03-21 18:22:00 - In reply to message 1 from gino pilotino
Or C#, Python, Ruby, etc...

That is normal. Many of PHP features were inspired in other languages.

If other language features are useful, it is natural that PHP developers also want them.

  3. Re: php, really ?   Reply   Report abuse  
Picture of gino pilotino gino pilotino - 2013-03-21 21:42:47 - In reply to message 2 from Manuel Lemos
let me dissent, imho it's not that natural. if i want to use strict type checking, then i'll go with a language that supports it by design. this is far more "natural" than trying to retrofit any peculiar property belonging to some other language; this often looks more like a nasty hack. people use php because it *lacks* features :) and this is completely understandable as it belongs to a different domain than java or something alike.

  4. Re: php, really ?   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2013-03-21 21:52:46 - In reply to message 3 from gino pilotino
PHP is a dynamic typed language, so you cannot have strict type checking at compile time (yes PHP is compiled before it is executed).

Anyway, in general people do not want strict type checking, they just want to get warnings when you are passing the wrong types of values to functions as that is a symptom you have bugs in your code. If you do not have bugs, type checking is not necessary.

Anyway, PHP already has type hinting as a built-in feature. The classes that emulated type checking are no longer necessary in the current PHP versions.

  5. Re: php, really ?   Reply   Report abuse  
Picture of gino pilotino gino pilotino - 2013-03-21 23:26:26 - In reply to message 4 from Manuel Lemos
As a php developer, I know what php provides :) let me relaborate.

Between the 26 points listed, Java covers about 70% _out of the box_, Scala about 90%. So it's more natural to me to chose a more feature rich language if I *really* want to use this kind of stuff in my everyday programming.

So why use php ? because in some scenario I *don't need* those features that otherwise would be counterproductive. It would be clumsy to chose Php *then* plug-in 20 external libraries that let me use it like it was java, scala, python, ruby or something else.

About the sentence "in general people do not want strict type checking, they just want to get warnings when you are passing the wrong types". Well, this is exactly what I meant when I said "people use php because it *lacks* some features" and not because you can plug new ones that other languages support by design.

  6. Re: php, really ?   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2013-03-22 04:36:22 - In reply to message 5 from gino pilotino
There seems to be a misunderstanding. This article was not advocating the use of these classes.

It was just telling that PHP has limitation that some developers could not stand and developed alternative solutions that run on current PHP versions.

Still some people would like to see these features in the language and others don't.

In general PHP developers do not like to develop in Java or any other language. They just wish PHP had some of the features they found in other languages.