newsapps/chicagocrime — pull request #4 by templaedhel (2013-03-24 21:16:20+00:00)
Title: refactor

This is the refactor I mentioned earlier. It covers a lot of area, but is actually fairly straight forward. The main change is I pulled a ton of logic out of the CrimeApp view file that should have been in the individual views. Common practice is that the views should be self contained, so that all that the router has to do is instantiate them with options (such as a community id) and then the view handles all of the data loading and such. This allows for more portability, since the views are independent and not reliant on data fetching and other logic in the superview.

It also allowed for getting rid of the show hide pattern in the views, since we can just construct and destruct the view elements at render time.

Overall the app has a much better (and more familiar) organization, as well as a somewhat reduced LOC footprint. Success!