View Full Version : Best practice MVC code organisation

22 Jun 2010, 11:45 PM
Hi guys ...

now that I'm getting the hang of Ext-style Javascript coding, I've noticed something I still know too good from the good old days of PHP coding ... Code Clutter!!!

Pull in some data here, open up a new Window there, I am somewhat lost about how to organize my code in a smart way. Good thing about PHP MVC frameworks these days is, that you can't really code sloppy anymore, you'll have to put your code in right places, otherwise it just won't work.

So with Ext, I've read about setting up 3 directories (controllers,models,views) and putting my files in them, but what would make a controller for example? The grid setup? Or is that part of the view?

So how do you guys do this ... I want to be able to understand my code even after not looking at it for year ;)

Thanks a lot in advance

23 Jun 2010, 12:04 AM
The view would be the grid config (e.g. what you can create with Ext Designer).

The controller would contain all the methods required to make the grid work (showing, loading, event handling).

There is some controversy wether the controller should handle raw events from the view or if the view should do basic stuff itself and only send actions to the controller.