Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

Do they mean the same thing (attaching URLs to actions, or actions to URLs) or is there any difference I'm missing?

Example: http://github.com/dannyvankooten/PHP-Router vs. http://konstrukt.dk

share|improve this question
    
that router sounds more like a glorified proxy to me –  ratchet freak Feb 17 '12 at 2:21
add comment

3 Answers

Router:

Routing is the process of taking a URI endpoint (that part of the URI which comes after the base URL) and decomposing it into parameters to determine which module, controller, and action of that controller should receive the request.

Controller:

Controller implements a »Controller pattern, in which all requests are intercepted by controller and dispatched to individual Action Controllers based on the URL requested(that is routing request from Router).

share|improve this answer
add comment

The route maps a URL to a controller, which is the action. Sometimes the roles are not really separated very well depending on the framework.

share|improve this answer
add comment

Quite simply a router works out a journey through the application, usually based upon external input such as GET or POST variables.

A Router is not however any part of an MVC, several MVC and HMVC frameworks use routers, but this does not bind them to the pattern of MVC.

Additionally several early implementations of MVC I have seen actually relied on file-based separation of actions with one file per controller for accessing separate controllers. This serves the application much better, because by having skinny controllers, with more robust models, you never have to scroll to a particular method in the controller, and you can therefore access the logic in one place (the model), allowing you to composite behaviours.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.