many include files vs one large include file
The company I work for is in the process of completely overhauling our
current intranet site by moving it onto a Drupal framework. One area I am
questioning is the number of include files we have. As it exists right
now, every single .php page has a corresponding .inc page. There are .inc
pages that provide certain functionality, but aren't tied to a specific
page. However, each .php page includes multiple files - at a minimum, it
will load the .inc page corresponding to it, and a few general scripts.
This makes trying to find a function definition a nightmare when
debugging.
My options right now seem to be the following:
1)Keep using this same system, but make it part of our convention to
include a commented line stating where the function is defined 2)
Consolidate all the include files into one large file. This would include
class definitions, function definitions, everything. My concern here is
that this file would get monolithic in a real big hurry. However, it would
have the advantage of keeping all function definitions in one place.
I don't like either option to be honest. My goal is to reduce dependencies
and make our code readable and easy to navigate. What is our best method
to handle this problem?
I should also state that this is very much legacy code - it hasn't been
refactored since it was created in 2003-2004. Just to give you an idea
what I'm working with, there is a lot of php echoing html:
printf("<center>\n");
printf("<table>\n");
printf("<tr>\n");
printf("<td align=left>Select Division:</td>\n");
printf("<td><select name=\"div\">\n");
printf(" <option value=1 \"selected\">Division1\n");
printf(" <option value=2>Division2\n");
printf("</select></td>\n");
printf("</tr>\n");
printf("<tr>\n");
printf("<td align=center colspan=2><input type=\"submit\"
value=\"Next->\"></td>\n");
printf("</tr>\n");
printf("</table>\n");
printf("</center>\n");
No comments:
Post a Comment