models in your application, and it seems that the method of extending the
Zend_Db_Table_Abstract is an OK choice for simple (quick and dirty)
applications and prototyping. However, I was also reading that the best
choice is to use pure OO domain modelling for the greatest flexiblity in
enterprise application development.
Now the application I am working on is by no means enterprise class material
here, however being a developer, I have dreams of it being enterprise class
material one day, so my thought is to do it properly from the get go, *and*
using pure OO design makes unit testing easier (I read, if anyone can point
me to some good resources on the best way to do unit testing / learn more
about it, I would be most appreciative).
Anyhow, one other post I was reading something was mentioned about
separating the data from the source. (hence not extending the
Zend_Db_Table_Abstract class). I have created a class with magic methods
for getting and setting properties (actually all in an array called _data),
and the magic methods define what can and can not be set, filters the data
being set, and takes care of what changes are pending (that need to be
written).
Now I have two data sources to read from:
First: I have a database table, where I check first if the record exists.
Second: I have another database table (completely different custom database
server/type, where I check second if the first returns non-existant (if the
second one is successful, I grab the record, and write it to the first
database (duplicating the record), and if the record doesn't exist I have it
throw an exception stating that the record doesn't exist in either database
table.)
Could someone give me a simple example of how to use the pure OO method to
handle this scenario?
I am assuming that I would pass an adapter (through the constructor) and
keep the business logic somewhere other than the model, but I am not quite
seeing how to do this properly. (and if you could show me a quick example of
unit testing that would be great too).
Thanks
Aaron
--
View this message in context: http://www.nabble.com/Pure-Domain-OO-Modelling-tp20949169p20949169.html
Sent from the Zend MVC mailing list archive at Nabble.com.
没有评论:
发表评论