Alex, I see your point. I also prefer to separate admin functions from user options is possible.
But in this case, if I want to have separate admin and user function, I have to duplicate the code, almost the same code (1-5% difference), except the admin has a few prints to display informational text on admin interface.
So, I have to maintain 2, almost the same (1-5% difference) functions, and I think this is infringement of the reusable code rule. I think, I should not duplicate the same code, because it will make my life difficulter.
Would cause any problem, if you would add a global variable ($admin = 1;), right at the start of admin.cgi?
I collected some advantages, disadvantages of that change:
- Disadvantage:
. . - takes a bit more namespace,
. . - and may need to wrap the admin part in a package (but not necessarily, I think)
- Advantage:
. . - at any point in the code flow, we can know if we are on the admin interface or we are displaying the site pages.
. . - makes possible more flexible coding, by avoiding so stick to the admin.cgi name,
. . - makes possible to avoid duplicating some codes
Best regards,
Webmaster33
Paid Support from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...
But in this case, if I want to have separate admin and user function, I have to duplicate the code, almost the same code (1-5% difference), except the admin has a few prints to display informational text on admin interface.
So, I have to maintain 2, almost the same (1-5% difference) functions, and I think this is infringement of the reusable code rule. I think, I should not duplicate the same code, because it will make my life difficulter.
Would cause any problem, if you would add a global variable ($admin = 1;), right at the start of admin.cgi?
I collected some advantages, disadvantages of that change:
- Disadvantage:
. . - takes a bit more namespace,
. . - and may need to wrap the admin part in a package (but not necessarily, I think)
- Advantage:
. . - at any point in the code flow, we can know if we are on the admin interface or we are displaying the site pages.
. . - makes possible more flexible coding, by avoiding so stick to the admin.cgi name,
. . - makes possible to avoid duplicating some codes
Best regards,
Webmaster33
Paid Support from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...