|
Re: Best practices in a thin-controller application: msg#00167php.zend.framework.mvc
Hi Adam, Adam Jensen wrote: 1. A good domain model is unaware of its own underlying data source This is where the philosophy part comes in to play: your rule #1 precludes perfectly valid patterns, such as Active Record, that "know" something about the data source structure. You have to decide based on your own philosophy, the app's requirements, and the trade-offs of different data source strategies, which approach is really the most useful. [code] To me, this doesn't violate rule #2 (based on my very superficial knowledge of what you're trying to achieve). Here, the data mapper has a fairly abstract interface that doesn't appear to tie you to any specific data source structure other than one identifying Trip objects by an integer. This would probably be flexible enough for most of the examples I've seen so far in this thread. Then again, although the controller is aware of the persistence layer, I agree: in MVC web applications, I think the controller's main job is to translate HTTP requests into some form of request upon the application's domain model, and then to express the domain model's results as something meaningful in HTTP. This means managing the interaction with domain model objects, and persistence is still part of the model layer. That said, if you want, you can use something like a Service Layer [1] to cleanly separate the HTTP-specific code from the domain-object management code. Use the Service Layer as a facade to create a very coarse API that would roughly correspond to what each controller action needs to do with the domain model. You'd have to decide if this would really be worth the effort for your application. Anyway...I really appreciate the continued discussion here...we almost Hope this helps, Bryce Lohr [1] http://martinfowler.com/eaaCatalog/serviceLayer.html August 1st is National Minority Organ Donor Awareness Day |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Zend_Form | Display Form Elements in one Row: 00167, Axel Wüstemann |
|---|---|
| Next by Date: | Re: Best practices in a thin-controller application: 00167, Jonathan Lebensold |
| Previous by Thread: | Re: Re: Best practices in a thin-controller applicationi: 00167, Adam Jensen |
| Next by Thread: | Re: Best practices in a thin-controller application: 00167, Jonathan Lebensold |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |