What is a good approach ?
Pugi!
First of all, I generally keep my functions short. Long functions can
indicate you're trying to do too much. Now I'm not saying you shouldn't
have long functions - but if your functions are normally large, you
might want to look at your code structure.
As for grouping, I place related functions together in one file. In
fact, I do more than that. I create classes to handle object, and
functions are members of those classes. Then I include the classes as
necessary.
Even my most complex pages don't require anywhere near 500Kb of files.
And I do have some pretty complex ones.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstu...@attglobal.net
==================
You're currently loading 500 kB of code for every request? That's not
good.
Firstly, even if you are running a webservice, a front controller
architecture undermines on of the fundamental concepts of HTTP -
addressability. There should be multiple entry points for different
areas of functionality.
Since you seem to be taking a procedural (or possibly) functional
approach to programming, IIRC the autoloader functionality will be of
no benefit.
Without knowing what your webservice does and what interfaces it
provides it is difficult to say how it should be split up but I'd say
you should definitely be looking at conditional includes based on the
entry point or request details and splitting up the functionality to
get the optimum number of files (e.g.
- one include file for soap parsing and input validation,
- one for database connectivity/dbms abstraction
- one which interfaces to the request specific include files (below)
and generates the output
(the above would be included every time)
- one for adding records of type 'A'
- one for deleting records of type 'A'
- one for updating records of type 'A'
- one for adding records of type 'B'
...
(note that although validation should be done at entry, encoding
should be done at the point the datum exits PHP to be written to the
browser or the database or somewhere else.
C.