Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I have an application where I have the 'core' code in one folder for which there is a virtual directory in the root, such that I can include any core files using /myApp/core/bla.asp. I then have two folders outside of this with a default.asp which currently use the querystring to define what page should be displayed. One page is for general users, the other will only be accessible to users who have permission to manage users / usergroups / permissions. The core code checks the querystring and then checks the permissions for that user. An example of this as it is now is default.asp?action=view&viewtype=list&objectid=server. I am not worried about SEO as this is an internal app and uses Windows Auth.

My question is, is it better the way it is now or would it be better to have something like the following:

  • /server/view/list/
  • /server/view/?id=123
  • /server/create/
  • /server/edit/?id=123
  • /server/remove/?id=123

In the above folders I would have a home page which defines all the variables which are currently determined by the querystring - in /server/create/ for example, I would define the action as 'create', object name as 'server' and so on.

In terms of future development, I really have no idea which method would be best. I think the 2nd method would be best in terms of following what page does what but this is such a huge change to make at this stage that I would really like some opinions, preferably based on experience.

PS Sorry if the tags are wrong - I am new to this forum and thought this was a bit too much of a discussion for StackOverflow as that is very much right / wrong answer based. I got the idea SE is more discussion based.

share|improve this question
    
so you are looking for something like mode_rewrite for jsp? What kind of server are you using? here is a sample answer for tomcat on stack overflow. stackoverflow.com/questions/1563799/… –  Daniel Iankov Sep 9 '12 at 12:59
    
No, what I am trying to determine is whether the design is better with just one page for everything, which makes heavy use of the querystring, or using lots of folders which contain files which define the variables themselves. For example /server/create/default.asp would contain the line 'action = CREATE' (where CREATE is a constant defined in /myApp/core/constants.asp). Basically is it better to use ?object=server&action=create or to use /server/create/? –  ClarkeyBoy Sep 9 '12 at 13:03
    
I am just trying it out now actually, just for a couple of objects, to see how much easier it is to add a new object type (category for the knowledge base, for example). –  ClarkeyBoy Sep 9 '12 at 13:04
    
Got it sorted for server, so the user just has to go to /myApp/server/ for the list, and then the edit buttons link to /myApp/server/edit/ and so on. Easy to change and I think it should be easier to manage in this way as I don't have to worry about the user being able to change the querystring (meaning it is more secure). –  ClarkeyBoy Sep 9 '12 at 13:11
add comment

1 Answer

The best way is to split it up. This will make it much easier to maintain because there are only small chunks that you need to deal with at any one time.

What you need to do is to first create a framework which will be used universally across all the pages/functions. This will have common bits in it like access control, menus, validation scripts, styles, etc

Then are there any objects that could be shared across pages? Things like business objects, data access layers, report generation, drop downs, etc. Put these into separate classes/files/etc. If you need to code it more than once, it should be in a library type file and included where required.

Now build pages for each discrete action, and group them by functionality or by permissions into separate folders.

Remember that a query string is an easy way for a user to enter in false data - does the application require a level of robustness? Best way is to use a session type object for passing information between pages for a security and integrity point of view.

share|improve this answer
    
Thanks for the input adam, much appreciated. I basically have it in this kinda layout: /ab/abCore/--all the core code files in here, then /ab/[business-object-name]/ for the list, /ab/[b-o-n]/edit/?id= for the edit page and then same for create / delete. Each business object has its own 'setup' file which sets all the variables which apply to all actions, then the individual homepages override them if they have to. All stylesheets are in one folder, scripts in another and images in another. It really is looking very neat now, and so easy to tell what should display what. –  ClarkeyBoy Sep 10 '12 at 19:18
    
In some cases I have nested business objects - for example /customer/contact/, /customer/address/, /customer/contact/address/ and so on. –  ClarkeyBoy Sep 10 '12 at 19:19
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.