Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Action Naming Convention

Has anybody established a good naming convention for action in MVC? I was specifically looking at ASP.net MVC but it is a general question. For instance I have an action which displays the login screen (Login) and one which process the login request from that page (LoginTest). I'm not keen on the names and I have a lot of the applicaiton left to write.

like image 289
stimms Avatar asked Sep 23 '08 00:09

stimms


People also ask

What are three naming conventions?

Project lead's last name or initials. File creator's last name or initials. Project name/acronym.

What is meant by naming convention?

A naming convention is a convention (generally agreed scheme) for naming things. Conventions differ in their intents, which may include to: Allow useful information to be deduced from the names based on regularities.


1 Answers

Rob Conery at MS suggested some useful RESTful style naming for actions.

* Index - the main "landing" page. This is also the default endpoint. * List - a list of whatever "thing" you're showing them - like a list of Products. * Show - a particular item of whatever "thing" you're showing them (like a Product) * Edit - an edit page for the "thing" * New - a create page for the "thing" * Create - creates a new "thing" (and saves it if you're using a DB) * Update - updates the "thing" * Delete - deletes the "thing" 

results in URLs along the lines of (for a forum)

* http://mysite/forum/group/list - shows all the groups in my forum * http://mysite/forum/forums/show/1 - shows all the topics in forum id=1 * http://mysite/forums/topic/show/20 - shows all the posts for topic id=20 

Rob Conery on RESTful Architecture for MVC

like image 174
Paul Shannon Avatar answered Sep 29 '22 12:09

Paul Shannon