Jump to content

Including Library Classes


Arty Ziff

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.