views:

76

answers:

6

I want to build a site that will ask if the user is male of female and then use that information to change all the pronouns on the page(s) to match the user selection. So if you enter male, then the page(s) will change all personal references to (him, his, he, etc). My choices are: 1) build 2 sites and have the user input direct the user to the correct site or 2)build one site that dynamically changes per user input

From a standpoint of performance cost and bandwidth cost, which is the better option?

+1  A: 

If you are just looking at performance and bandwidth, it is definitely better to have two static pages: Proxies and browsers can cache the pages, which helps both. Is that still the better way? Well, depends on what your maintenance plans are like. Are you going to be updating the pages often? In that case, you will need to make sure that you always apply the updates to both pages.

Adam Batkin
I will not be changing the content of these pages, but I will be adding new pages, which means in the future writing two versions of every page that gets added.
Molex
A: 

option "2", with a lightweight javascript and you do less calls to the server, but with jQuery ( "# id").load("page.php") only part of the html you need to change

andres descalzo
A: 

I am a believer in the KISS principle. There is nothing wrong with having two JSP pages. It is clean and easy to read. However, in your case a simple jQuery function, that is kicked off by them entering him/her, would not be difficult or hard to maintain. The performance will be good and the bandwidth will be better (since you are changing the text client side with script).

amischiefr
A: 

Does this site plan to grow in features? For example, will you need to ask for a language selection one day and have the user's content presented in their language? For a simple bilingual site you would then require 4 pages (2 languages x 2 genders).

If you then need to present certain data based on a region selection, you would have to multiply the number of pages again by the number of regions.

Static is very efficient for unchanging pages, but if you need to leave yourself room to grow and add more capabilities in the future, dynamically generated pages where the content is pulled based on a users selection of criteria is much easier to maintain.

Jay S
A: 

I wouldn't use JavaScript for this at all. I would request the gender from the user and handle the pronoun determination on the server side. By templating pronouns in your content, you can do a simple search and replace before serving the pages which will make maintenance simple.

Justin Johnson
A: 

You could do it with CSS - eg in the HTML of the page have:

[span class="male"]him[/span][span class="female"]her[/span]

... and then switch CSS stylesheets based on user choice, recording the choice in a cookie.

One stylesheet would have:

span.male { display: none } span.female { display: inline }

and the other would be:

span.male { display: inline } span.female { display: none }

You get the idea...

Simon