Hi, what are the differences between Collection, Method and Action? How to call each?
Robin Cua wrote:
Hi, what are the differences between Collection, Method and Action? How to call each?
Collection: An array of objects, resources, etc.
Method: A "function" that is scoped within a class or object instance in an Object Oriented Program (OOP).
Action: A "special" method that is defined in a controller object in a Model-View-Controller design.
The action is no different in reality from any other method. It's only differentiated by how, and where, it is used. Controller objects have methods. Some of these methods are referred to as "actions" because they are typically called as a result of some "event."
In a web application that typically means the event is an HTTP request. The duty of the action method is to process the request by sending messages to the model and view objects to generate an HTTP response. The response body can be HTML, JavaScript, PDF (or any other binary file), RSS/ATOM, etc.