"should sorting logic be placed in the model, the view, or the controller? [closed]" Code Answer

1

(note: this quote and citation is taken from @dasblinkenlight's answer, but we disagree on our interpretation of it. read his post and make up your own mind).

according to mvc description,

a controller can send commands to its associated view to change the view's presentation of the model (for example, by scrolling through a document). it can send commands to the model to update the model's state (e.g. editing a document).

sorting logic (e.g., the sorting comparator/sorting algorithm) belongs in the model since it contains business rules and state data. since altering the way the model data is sorted falls squarely into the "change the view's presentation of the model" category, the controller is responsible for "doing the sorting" by calling the model.changesortedstate() method.

By rlc on January 13 2022

Answers related to “should sorting logic be placed in the model, the view, or the controller? [closed]”

Only authorized users can answer the Search term. Please sign in first, or register a free account.