By Peter Bell

Extends Still Easier

So, I played around with dynamically mixing in all of my methods at runtime using class based mixins instead of extending from base classes.

An interesting experiment, but not worth the trouble. The problem is that you lose the Super.[methodname]() capability to overload a base class (or custom class) and then still call the super method.

There is a fairly easy solution which is you look for any overloaded methods and rename them dynamically as Base[MethodName] or Generated[MethodName], but now your code is dependent on a very non-standard convention. It is easier just to generate the base, generated and custom class files and to have them extending each other. Main thing to remember is that you have to generate the class files rather than copying them as the extends property must be static so your class files are dependent on your application mapping (e.g. extends="myapp.com.base.BaseDAO" - when you post to myapp2, you need to regenerate the class file with an extends="myapp2.com.base.BaseDAO" - you can't just variabilize it at runtime with "extends="#application.name#.com.base.baseDAO").

Comments
BlogCFC was created by Raymond Camden. This blog is running version 5.005.