NYCPHP Meetup

NYPHP.org

[nycphp-talk] Extracting an int from a query string.

John Campbell jcampbell1 at gmail.com
Tue Nov 13 12:23:46 EST 2007


>  Where ever you can, write a function.

I always debate about whether to use what I call "micro libraries".
When I write them, I find them handy.  When someone else writes them,
I cannot stand them.  I assume other people feel the same way, so I
avoid using them beacuse I assume people will hate my micro libraries.
   I have also found that if you have n php developers, you will have
n micro libraries.

If the code is pure php, you can always just type
php.net/function_name, and get the docs.  If a script starts with a
dozen includes, and you come across a function that is not in the
manual and is not a class method, there is no immediate way to figure
out what is does.

What are other peoples' thoughts about 1-2 liners vs global functions?
 If you do use micro libraries, do you wrap them in an static class?
Have you ever worked on an existing code base and thought, "wow these
little helper functions are great"?

-John Campbell



More information about the talk mailing list