Arty Ziff Posted October 9, 2011 Share Posted October 9, 2011 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? Quote Link to comment https://forums.phpfreaks.com/topic/248731-including-library-classes/ Share on other sites More sharing options...
silkfire Posted October 9, 2011 Share Posted October 9, 2011 You can copy the function into your own code, maybe? Quote Link to comment https://forums.phpfreaks.com/topic/248731-including-library-classes/#findComment-1277398 Share on other sites More sharing options...
Arty Ziff Posted October 9, 2011 Author Share Posted October 9, 2011 You can copy the function into your own code, maybe? Maybe I can. But my question has to do with the way in which php "includes" files behind the scene and how much "overhead" such things actually add... Quote Link to comment https://forums.phpfreaks.com/topic/248731-including-library-classes/#findComment-1277399 Share on other sites More sharing options...
MasterACE14 Posted October 9, 2011 Share Posted October 9, 2011 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. Quote Link to comment https://forums.phpfreaks.com/topic/248731-including-library-classes/#findComment-1277401 Share on other sites More sharing options...
ignace Posted October 9, 2011 Share Posted October 9, 2011 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 Quote Link to comment https://forums.phpfreaks.com/topic/248731-including-library-classes/#findComment-1277402 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.