I create a site using VMC and using beans to transfer data from the model to the controller / view.
I plan to implement some basic and very simple caching that will store beans in a simple structure if they have not changed (as we grow in use, we will implement the best caching system around version 1.3).
So, the question is what is going on in our bean.
One type of bean will contain only basic data and will rely on some external service to do the rest of the work (referring to the DAO to get the request, parsing the request to load the bean values). This is "bean anemia", as an employee repeatedly informed me :-).
Another type of bean will be more autonomous. He would know where the DAO would go so directly to the DAO to receive a data request. It will contain the necessary functions for analyzing the request and setting properties. Basically, it will combine most of the โserviceโ layer with a bean, leaving a direct database in the DAO layer.
Of course, for the controller / views, both beans will look and act the same.
But the question is memory and how ColdFusion / Java deals with it.
Using an anemic model, the bean will have enough memory to store variable properties with just one touch to point to the Service when needed.
With heavier features of the second type of bean, will the cache require more memory? Will each bean copy have a full copy of the methods?
I am inclined to think that the second model will not have much more memory, since they "divide" the methods and only need memory for variable properties.
IMHO the second method would simplify the code base, since the bean code would be closer to the bean, and not scattered between the DAO and the services. And this would reduce the simple functions in the Service, which would simply pass DAO calls from the bean, could go directly to the DAO, when it was necessary ...
Does the question make sense? Or at least how do I ask this?