Re: [PHP] Just for fun:
Thanks Mathew, Jason and Joseph for the reply. I never thought that having a large function could be a bad thing. I'll keep your tips in mind when writing functions from now on. Fortunatly, the function I was refering to that was 100 lines is a one time use function. It's only used to setup the backend for my script, and after that it's never called during normal use. (the user would have to delete the configuration file in order for the function to be called again.) Theoreticly, I could take out a lot of "check and balance" type of code, and get it done in half the lines, but realisticly that wouldn't be too good for the overall setup of the script, since it is defining the core of the application. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Just for fun:
>When you find yourself writing HUGE functions, it may be better to split it >into smaller, more clearly defined functions or classes and do it that way... I totally agree i tend to split my class functions into user (public) and private (helper) functions which does tend to keep all the functions nice and compact the user functions usually just combine a number of the helper functions together, don't know if this the best way but works for me (c: Regards, Joseph -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Just for fun:
One of my largest is a function of a complete session management class that I wrote - 150 lines. The class is ~ 450 lines. When you find yourself writing HUGE functions, it may be better to split it into smaller, more clearly defined functions or classes and do it that way... -Jason Garber Lead Programmer - pulseaday.com At 08:40 PM 9/20/2001 -0400, Matthew Loff wrote: >-Original Message- >From: Jason Bell [mailto:[EMAIL PROTECTED]] >Sent: Thursday, September 20, 2001 8:32 PM >To: PHP Users >Subject: [PHP] Just for fun: > > >Here is a question, just for fun: > >What is the biggest function (In terms of line count) you have ever >written? > >I just finished one that is 100 lines long. That is by far my >biggest It's a script initialization function that sets up database >connectivity, creates all tables necessary for my script, and creates an >administrative user. > >-Jason > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] >To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Just for fun:
-Original Message- From: Jason Bell [mailto:[EMAIL PROTECTED]] Sent: Thursday, September 20, 2001 8:32 PM To: PHP Users Subject: [PHP] Just for fun: Here is a question, just for fun: What is the biggest function (In terms of line count) you have ever written? I just finished one that is 100 lines long. That is by far my biggest It's a script initialization function that sets up database connectivity, creates all tables necessary for my script, and creates an administrative user. -Jason -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]