|
Posted by Jerry Stuckle on 12/29/07 18:58
JM wrote:
> Because my functions tend to become rather lengthy I split up the
> functions for each subject or action in a function (a) that checks user
> input (filter and validation) and if this checks out ok it passes the
> variables to another function (b) that retrieves or stores the data
> from/in the database, function (a) then communicates the result (true,
> false, error, list with data) to the client.
> Currently I organized all functions per subject (all functions that
> handle for example 'groups': get, add, modify, delete in a file) and I
> include all the files when the webservice is called, this is over 500 kB.
> A different approach would be to only include the functions needed, this
> means a file for each function, so a lot more includes.
>
> 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.
jstucklex@attglobal.net
==================
Navigation:
[Reply to this message]
|