Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: (z) Separation of SQL code

by bean (Monk)
on Sep 11, 2003 at 17:23 UTC ( [id://290758]=note: print w/replies, xml ) Need Help??


in reply to (z) Separation of SQL code

Unless you've benchmarked your application and found this to be a real problem, I wouldn't worry about loading a little extra code. Other issues will be more important. Does your site use authentication? Don't reauthenticate every page (seems obvious, I know, but I'm supporting an application that does this - and I can't change it because my group does not control the authentication module) - use Apache's native authentication or an encrypted cookie instead. Cache database queries when appropriate. Instead of keeping session information in the database or on the server, keep it in the user's (encrypted) cookie. Javascript, while annoying to write (and a possible accessibility issue), can help you avoid unnecessary hits on the server. For instance, instead of redirecting server-side, you can redirect client-side - instead of reloading the page to get a secondary drop-down list, create the list dynamically. I once wrote a file manager application that loaded the user's entire directory structure into a javascript hash - then the user could navigate through his/her directories without hitting the server again - javascript would rewrite the page as appropriate (this was necessary because the users were in South America with slow connections and the server was in New Jersey). If you duplicate (at least some) form validation client-side, you'll have fewer resubmits, which will lighten the load on your server (I said "duplicate" because you'll still have to do all the validation server-side, since you can never trust information from the client). If you're writing a web based application (file manager, mail client, quality record system, chat room, etc) rather than something people will want to bookmark (a news-site, blog, etc), frames (although unfashionable) might be appropriate - they divide the application into discrete units (for a three-frame application, usually main navigation, secondary navigation, and the active screen) and make it so you don't have to reload parts of that application that aren't changing. If you do use frames, be sure to include code to maintain frame state (if a frame is loaded independently, redirect to the frameset). Even if your project doesn't lend itself to frames, you can still cache sections of the page, like navigation, polls, etc.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://290758]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (4)
As of 2024-04-19 07:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found