Welcome Guest, Not a member yet? Register   Sign In
What's the right place for sort algorithm? Model? View? Controller?
#1

[eluser]Unknown[/eluser]
Hi!

I am new in MVC frameworks, so I have a question related to MVC paradigm.

I have SQL table with number of points with GPS data (lat/long).
And I have php algorithm (function) that can sort points by distance from any point.

My question is what is the correct place for that sort function?

1. May be model function should take parameters like $sort_by_point_lat $sort_by_point_long and sort these points
Code:
function get_points($sort_by_point_lat, $sort_by_point_long) {}

2. Or may by controller should sort them as it received from model
Code:
function show_points()
{
$my_points = $this->Points->get_points();
$this->sort_by_distance($my_points,123,456);
}

3. Or may be View should do it then it displays these points.


What do you think? Thanks!


Messages In This Thread
What's the right place for sort algorithm? Model? View? Controller? - by El Forum - 08-12-2009, 06:12 AM



Theme © iAndrew 2016 - Forum software by © MyBB