View Full Version : MVC code structuring and best practice..HELP PLZZ
11 Feb 2012, 11:55 AM
I am very new to EXTjs, we have tought to develop a web application in extjs. i have 9 navigational flows(nothing like a border layout). its all page navigation.
As i went through the MVC pattern and i have designed to create a 1app, 1controller and 9views. and this app will go under only one Html/Jsp file.
Question 1: is this the right approach??? ( if i wil have a multiple apps i may not be able to interlink all the view together Ex: i need to pass the form values of view 1 in view 2.)
Question 2: is there any approach if i can create a single app, multiple views in 9 different HTML files and handle all the data between the controller
Question3 : currently as planned i have thought of using 1app, 1controller and 9views. and this app will go under only one Html/Jsp file and use Ext.insert(index,view) to bring the required view to front. (any disadvantage of this).
Kindly help. we are already late to start development.
12 Feb 2012, 7:58 AM
The application architecture is up to you. I recommend looking at the application's features and create a controller for each feature. I try to keep a single class pretty small, I don't want a class to get to 500 lines of code... like mine to be less than 200 if possible.
If you create a multi page (multi HTML page) application then those apps should be thought of as separate apps. Remember, each page will have to download the framework and that is expensive. If you can do a single page app I would recommend it very much.
I use add/insert/remove on containers to add child items and then use things like setActiveItem if it's in a card layout. To navigate to a view, it depends on your app and layout.
12 Feb 2012, 7:58 PM
Remember, each page will have to download the framework and that is expensive.
im not 100% sure but thats not true, all modern web browsers cache static things, like js, images, and css html etc, thats why even ExtJs uses the trick thats add some random values after a "link" to a resource so the browser will load it again but if u add something like <script scr="mylibrary.js"> browser will ask "i have this on cache?" "yes" so lets use it and dont download again.
for the original post, i think if u have big app with many "pages" its better to build an Ext.application just with the view/controllers/models and w/e thats necesary to load the main window, dont declarate the 9 views in it.
as the user enters to the view 7, load the necesary files (and its dependencys) to get that view 7 working, using getController o Ext.require or w/e u like.
if you are building a 20 "pages" app, and a user logs in just to use 1, he doesnt need to wait for all 20 pages get loaded, just load that one view, extjs is heavy enough to put a 20 pages app over it and u end with a heavy site thats unusable.
bad english at its best.
12 Feb 2012, 8:15 PM
Either you don't have login or you are doing login via http not https which then you are sending passwords in plaintext which isn't good. Secure server, nothing is cached.
12 Feb 2012, 11:13 PM
So wat we understood here is to use the multiple controller, multiple views.
Any action on controller 1 will load all the neccesary views only for controller1 views.So there will not be heavy data on the application launch.
So this should work fine???????????.
12 Feb 2012, 11:24 PM
lets say we have navigated till view9. so would the previous views be destroyed and not be tooo heavy on the browser cache/memory. Bcoz there is too much of data to be displayed in all the views
and is it required to destroy those views. ???
All i want to know is if this application would become heavy on the browser. and end up bad :)
Powered by vBulletin® Version 4.2.3 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.