Wednesday, September 29, 2010

Two code completion 'FAIL's with PHP

Note that _ denotes cursor.

#1


$user = Doctrine_Core::getTable('User')->find(1); $user->_
Code completion at this point should return all members of the "User" class, but we get nothing!

#2


$logger = Zend_Registry::get('Zend_Log'); $logger->_
It should provide a list of Zend_Log members, but... nothing!

So... it's not about dynamic typing vs static typing. It's more about type safety but maybe more accurately type awareness or simply type information.

The above probably also holds true with Ruby on Rails. (and it's probably the fault of Rails' super-flexible-dynamic design by nature)

Compare Cases with Type Information (or sometimes, Type Inference)


But very rarely heard in Java :

@Inject EntityManager em; ... em->_

You get full code completion above. And even at times when you get a dumb Object, you can always typecast to the type you know you want.

No comments:

Post a Comment