I will define the model approach as A and the modules approach as B. They both have pros and cons. file A follows more along the web2py idioms, in being implicit, your functions are just there, but on this same token you have namespace pollution, and a functional programming style. file B is designed after Admin. It allows you to pass named objects instead of it relying on your global namespace. You can initialize it at any time, when YOU want, but at the cost of having to be explicit. You also get the benefit of inheritance, so you can define a plugin that inherits an existing plugin but includes extra functionality.
It really depends on your style of programming. I was raised Java, I have the object oriented model ingrained in me, and struggle with this "functional" programming style. Obviously I prefer method B because it is more natural for me. Web applications by design have a functional pattern, as does web2py, so A makes "sense" to be preferred. I also think it really depends on what kind of plugin you are developing. Certain things make more sense as one or the other. I mainly did both A and B to see if it could be done with both, and which one I preferred. -Thadeus On Thu, Mar 11, 2010 at 9:08 PM, Alex Fanjul <alex.fan...@gmail.com> wrote: > Hi Thadeus, > For me, its much more "clear" to understand and code this one approach: > http://code.google.com/p/blogitizor/source/browse/src/models/plugin_comments.py > than this one: > http://code.google.com/p/blogitizor/source/browse/src/modules/plugin_comments.py > > Maybe it's beacuse Im not a hard python coder... > but, what are the main differences (adventages and disadventages) for each > one, which do you prefer to code for? > > thanks, > alex > -- > Alejandro Fanjul Fdez. > alex.fan...@gmail.com > www.mhproject.org > > -- > You received this message because you are subscribed to the Google Groups > "web2py-users" group. > To post to this group, send email to web...@googlegroups.com. > To unsubscribe from this group, send email to > web2py+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/web2py?hl=en. > > -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.