Jump to content

Recommended Posts

Suppose you have a ENORMOUS library class where you have collected - perhaps - validation functions.

 

Suppose you also have a small php script that you wish to use one of these validation functions in.

 

So, you include the class.

 

Is there a lot of "overhead" involved in including a huge class of which you use only one function?

Link to comment
https://forums.phpfreaks.com/topic/248731-including-library-classes/
Share on other sites

you'd have to instantiate the class. Where as if it was a stand-alone function that wouldn't be the case. Overall I don't think it'd make much of a difference at all, only micro-optimisations choosing one over the other. In this particular scenario anyway.

Clearly having one class that has validation code for nearly everything is not gonna be too efficient, I'm not saying it will slow down your system just that it's not efficient. It would be better to have one class for each specific validation like Zend Validate does.

 

http://framework.zend.com/manual/en/zend.validate.set.html

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.