Welcome Guest, Not a member yet? Register   Sign In
Naming Controllers for Keyword Rich URLs - Good or Bad practice?
#6

[eluser]Michael Wales[/eluser]
Quote:Search with a function named location()

Yucky yucky yucky. Sure, this would work but it's horrible development practices. Controllers should almost always be named objects (cars) and the methods are things you can do to those objects (drive the car).

Seeing a controller named "search" makes me think we are storing, manipulating, users search data - maybe the strings people search for. $Search::location() - maybe a geographic heatmap of where Google searches are coming in from?

When naming classes ask a few questions:
1. What am I trying to do?
2. What am I doing this to?

#1 is the method name, #2 is the class name.

Good examples:
$Article::view()
$Product::create()
$User::delete()

The only time this train of thought should be deviated from is in regards to list() in which case I usually just use index() because that's typically what you would expect. I go to domain.com/pencils I expect a list of pencils you have for sale.


Messages In This Thread
Naming Controllers for Keyword Rich URLs - Good or Bad practice? - by El Forum - 02-03-2010, 12:10 PM



Theme © iAndrew 2016 - Forum software by © MyBB