jeudi 27 mars 2014

How many controllers do you have in applications?

I am posting this here, cause I think I would do things differently if I was using a different IDE for coding (esp. if I had better refactoring, etc.). but wonder if others are doing what I have found most efficient:



1) I generally have a controller per view (assuming the view has normal CRUD (create, read, update, delete) functionality.

2) I create a reference to the view, all buttons and any "special fields"

3) my controller has functions for when add and delete buttons are pressed

4) I have an "edit" and "select or selection change" function to handle logic when a record is selected (perhaps read child records, enable delete buttons, etc.) or edited (validate and save the data)



Once I write this once, when I create a new view, I copy the controller, and just edit the reference control queries and that handles about 90% of the logic.



Does this make sense? Is there a better, more efficient way?



Bruce




Aucun commentaire:

Enregistrer un commentaire