Web Application Development Tips

Read these 13 Web Application Development Tips tips to make your life smarter, better, faster and wiser. Each tip is approved by our Editors and created by expert writers so great we call them Gurus. LifeTips is the place to go when you need to know about Web Development tips and hundreds of other topics.

Web Application Development Tips has been rated 3.2 out of 5 based on 287 ratings and 1 user reviews.
Do I need to comment code?

Properly Comment your code

My motto: "Code as if the person taking over my position is an insane killer" -- Meaning, if they can't understand what I did, they might come looking for me. ALSO, if you have to revisit a piece of code you wrote long ago, it helps to know what you did, and why. When you create a new function, add a comment block at the top. When you start a new webpage, add a comment block at the top. When you change a line of code somewhere in the page, either add a revision line at the top, referencing the changed code, or use an inline comment where you actually changed the code. For a good example of commenting code, see www.meridiandevelopmentsystems.com/lifetips/03.htm

   
How are web applications structured?

How are web applications structured?

Web applications are developed as three-tiered client-server applications that separate user interface, process logic and data administration. These tiers are maintained independently, allowing for flexibility in location, operating system and development languages.

   
What can I do to simplify my dynamic web pages?

Stored Procedures

If you are using a database, try to use stored procedures instead of inline asp database code.

Stored Procedures are scripts that are run on, owned by, and specific to your database. They generally reside IN your database files. If you have ever looked at a very large asp file (I have seen rediculously large 2000+ line asp files - complete with functions, html, database calls, sql text, style information, etc.), and I will tell you it is not pretty, nor is it easy to change, maintain, edit, or even follow. If at all possible, don't have inline sql. If you can access the database, and use stored procedures, not only will it make the code easier to follow, but you'll never have to dig into the code again to make data changes - simply edit the stored procedure on the database, or the function call you create that calls the stored procedure. For a better example, see www.meridiandevelopmentsystems.com/lifetips/05.htm.

   
Do I need to comment code?

Properly Comment your code

My motto: "Code as if the person taking over my position is an insane killer" -- Meaning, if they can't understand what I did, they might come looking for me. ALSO, if you have to revisit a piece of code you wrote long ago, it helps to know what you did, and why. When you create a new function, add a comment block at the top. When you start a new webpage, add a comment block at the top. When you change a line of code somewhere in the page, either add a revision line at the top, referencing the changed code, or use an inline comment where you actually changed the code. For a good example of commenting code, see www.meridiandevelopmentsystems.com/lifetips/03.htm

   
How can I save my variable information in cookies for later retrieval?

Using cookies

You can use cookies (local files) to store information instead of having to post variables back and forth between pages. It's easy - just use the request.cookies and response.cookies objects and methods. To save a value to a cookie, simply create a value, such as oranges: response.cookies("oranges") = 13 -- now you have a cookie on your computer with a key name of "oranges" which has a value 13. To retrieve the information, use the request.cookies method as: myVar = request.cookies("oranges") which will retrieve the value 13. You can also use the cookies as collections, such as response.cookies("oranges")("navels")=13. Now you have 13 Navel Oranges stored. To retrieve, use the same format: myVar = request.cookies("oranges")("navels").

   
How can I save my variable information in cookies for later retrieval?

Using cookies

You can use cookies (local files) to store information instead of having to post variables back and forth between pages. It's easy - just use the request.cookies and response.cookies objects and methods. To save a value to a cookie, simply create a value, such as oranges: response.cookies("oranges") = 13 -- now you have a cookie on your computer with a key name of "oranges" which has a value 13. To retrieve the information, use the request.cookies method as: myVar = request.cookies("oranges") which will retrieve the value 13. You can also use the cookies as collections, such as response.cookies("oranges")("navels")=13. Now you have 13 Navel Oranges stored. To retrieve, use the same format: myVar = request.cookies("oranges")("navels").

   
Who uses web applications?

Who uses web applications?

Actually, these days pretty much everyone uses some sort of web applications. If you use Gmail, you use a web application developed by Google called an e-mail client. There are endless opportunities for web application development. Consider that online stores, online auctions, wikis, discussion boards, weblogs, contact managers, photo sites and many of the other things you DO online all involve web applications.

   
What are web applications?

What are web applications?

Web applications are operating-system independent server-side programs accessed by the user over the internet through a web browser. Using web browsers as 'thin clients' web application developers do not require users to upgrade any software when enhancements are made to the system.

   
How can I learn more about web application development?

How can I learn more about web application development?

One of the best ways to learn more about web application development is to attend a web application developer conference like Web Design World, in Boston. This conference is perfect for Boston Web development companies who are looking to learn more about the up and coming technology. Find one in your area, or save up and spend the bucks to go. It will certainly be worth it!

   
What can I do to simplify my dynamic web pages?

Stored Procedures

If you are using a database, try to use stored procedures instead of inline asp database code.

Stored Procedures are scripts that are run on, owned by, and specific to your database. They generally reside IN your database files. If you have ever looked at a very large asp file (I have seen rediculously large 2000+ line asp files - complete with functions, html, database calls, sql text, style information, etc.), and I will tell you it is not pretty, nor is it easy to change, maintain, edit, or even follow. If at all possible, don't have inline sql. If you can access the database, and use stored procedures, not only will it make the code easier to follow, but you'll never have to dig into the code again to make data changes - simply edit the stored procedure on the database, or the function call you create that calls the stored procedure. For a better example, see www.meridiandevelopmentsystems.com/lifetips/05.htm.

   
How do I handle errors in asp?

Error handling in asp

When your code bombs and displays a "Page can't be reached" or and other error page, it's embarrasing. Here's a more elegant way to handle it. Use "On Error Resume Next" and "On Error Goto 0" EFFECTIVELY. First create an error page yourself - one that not only looks better than the standard error page, but that also tells the user something usable.. and include a "go back" button if necessary.

To use the above, write:
On Error Resume Next
...on the line ABOVE where the error would possibly happen, for instance, just before a database call.

Then on the line immediately after the offending line, write:
If err.number <> 0 then response.redirect "yourerrorpage.asp?err=" & err.description
*note: use this redirect ONLY if you want to alert the user of the error. You can omit this if you simply want the user to continue without an error showing up. You will have to find out why the error happened, but that's out of scope with this tip.

After that offending line, write:
On Error Goto 0
-- this resets the error object.

On your error page, at the top (but within the <% %> code block) write:
response.write "Error: " & request.querystring("err") & "
please contact your administrator, or to try again, click here" (originalpage.asp is the page you had the error).

Microsoft has a good resource on this topic.

   
What is the future of application development?

What is the future of application development?

Application Development will allow future creation of processes that increase the speed and flow of information across an enterprise, application, platform and skill set. Application development will deliver these through new applications designed for agility, and by evolving existing software for reuse.

   
How do I handle errors in asp?

Error handling in asp

When your code bombs and displays a "Page can't be reached" or and other error page, it's embarrasing. Here's a more elegant way to handle it. Use "On Error Resume Next" and "On Error Goto 0" EFFECTIVELY. First create an error page yourself - one that not only looks better than the standard error page, but that also tells the user something usable.. and include a "go back" button if necessary.

To use the above, write:
On Error Resume Next
...on the line ABOVE where the error would possibly happen, for instance, just before a database call.

Then on the line immediately after the offending line, write:
If err.number <> 0 then response.redirect "yourerrorpage.asp?err=" & err.description
*note: use this redirect ONLY if you want to alert the user of the error. You can omit this if you simply want the user to continue without an error showing up. You will have to find out why the error happened, but that's out of scope with this tip.

After that offending line, write:
On Error Goto 0
-- this resets the error object.

On your error page, at the top (but within the <% %> code block) write:
response.write "Error: " & request.querystring("err") & "
please contact your administrator, or to try again, click here" (originalpage.asp is the page you had the error).

Microsoft has a good resource on this topic.

   
Not finding the advice and tips you need on this Web Development Tip Site? Request a Tip Now!


Guru Spotlight
Kristle Jones