Embracing the PHP philosophy
no single dictator or design committee
PHP assimilates
what some call quirks
- needle haystack or haystack needle -
- to under_score or not -
others may call 'backwards compatibility'
learn to use code completion
P.S.
array function? -> needle haystack
string function? -> haystack needle
cute, so you're a hotshot programmer
now what does this
AbstractSingletonProxyFactoryBean
actually do?
don't use design patterns just because you can
don't name your functions after generic design patterns
design patterns are a code smell
we're not programming java here
php isn't fuzzy about types
avoid type hints and embrace duck typing
it's not what you think
$info = $treeNode->info; $treeNode->cd('..'); $info2 = $treeNode->info;
$info2 = \mylib\tree::cd($treeNode, '..')->info;
embrace composition and encapsulation
use 'final' and 'private'
(some hooligans disagree)
call it dependency injection and you are cool too
large class hierarchies are a code smell
when in doubt, leave it out
don't overthink, build what you need now
conform to the language
work with standard types if at all possible
emulate them if not
( toString(), ArrayObject, etc.)
keep the learning curve low
there is a lot of useful code out there
even if you don't like the quality, chances are they fixed problems you haven't found yet
http://phptrends.com/
http://packagist.org/
do check the license though