Welcome Guest, Not a member yet? Register   Sign In
question good practices with controllers
#1

[eluser]pabloheim[/eluser]
hi friends, i have question about good pactices :

Imagine you are developing an application where an "user" can create, edit , delete an "element".

In your opinion, what is the best way to design the controllers ?

option 1 :
create controller "user" with functions : "create_element", "edit_element", "delete_element"

option 2:
create controller "element" with functions: "create" ,"edit" ,"delete"

hope you can help me

thanks!!
#2

[eluser]flaky[/eluser]
the url will look cleaner of you use option 2 (I prefer and use option 1)
eg
Code:
http://example.com/post/create
http://example.com/post/edit
http://example.com/post/delete

rather than option 1
Code:
http://example.com/post/create_element
http://example.com/post/edit_element
http://example.com/post/delete_element
#3

[eluser]danoph[/eluser]
Hi,

You should use the "RESTful" option 1. Google RESTful and you will see why this is the better method.




Theme © iAndrew 2016 - Forum software by © MyBB