There are two reasons to avoid $uses and loadModel in your code.

1. performance:
Extra memory will be consummed if you have var $uses and the
association in your model.
loadModel simply checks if the class exists and includes it if it does
not, so the overhead here is minimal. But then you need to create the
instance so memory is increased. If you go this route, use the
ClassRegistry. By using the registry when you need to gain access to
an object you can be assured that you are not adding any extra
overhead.

2. maintainability
everyone knows we are concerned with maintainable code. We provide var
$uses for the exceptions to the rule (ie: contact form, search, etc)
These are cases where there is generally no model for that controller
and so there is a need to override the default behavior. On the other
hand, loadModel can create spaghetti plain and simple. Using loadModel
can be likened to using sql in your templates, albeit a little more
elegantly.

But this is really off topic, because I doubt the site is running slow
because of the model loading. It is most likely an issue with server
load and/or max clients on apache.



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to