As I write more Ruby, thoughts of what should go where have occurred to me. While having monolithic packages take the load off package users, the question of performance penalties arise. If everything is loaded up front when a simple require is done, a full package monolithm may take more time to load than that required when just a simple piece of functionality is needed.
I'm thinking that a nice runtime feature to develop would be to include a "require-manifest" array (or tree perhaps) in a package base class that would be used in case missing methods were encountered. If a method was missing, the manifest could be used and additional requires would be sent, and then the offending method could be resent. If the method was still missing, additional action could be taken.
This strategy would effectively lazy-load class extentions automatically as needed, removing startup performance penalties for applications, time-shifting the load to when a set of advanced features is used. For simple applications that do not use the extended features, the time could be eliminated completely. It does require a bit of planning ahead, building and maintaining the require-manifest structure, but perhaps this could be done by a packaging script...
Of course, this would not prohibit the direct loading of a specific package nor calling the method to load entire manifest at startup, if desired.
No comments:
Post a Comment