tags:

views:

91

answers:

2

I do not have a ton of PHP experience, but whenever I have been given legacy code or even recent PHP code, one thing that always strikes me is how BIG the functions are. In seems like every .php file as at least one page-long function in it. Is there any intrinsic reason why functions and methods in a dynamic, high-level language like PHP should be so huge? The only kind of code I can think of that exceeds it in lines-per-function is C code. Why does PHP code always look this way?

+13  A: 

No, there isn't any reason why the functions should be larger in PHP.

If the functions are huge, they were the result of a bad design.

Perhaps you're dealing with PHP scripts written by people with little programming experience, who didn't know how to write well-structured programs.

Artefacto
These weren't scripts, they were full enterprisey applications.
newtophp
@newt PHP is a scripting language; full applications are composed of several script files.
Artefacto
@newtophp 'enterprise application' is not synonymous with 'well designed application'
Michael Robinson
+5  A: 

Why does PHP code always look this way?

Because you haven't seen good PHP code.

Mike B
Then again, nobody has. ;-) SCNR
Tomalak
Yeah, I'm open to that. I just thought it was strange that so much looked that way.
newtophp