Designing Active Server Pages: Scott Mitchell's Guide to Writing Reusable Code

Overview

Developers of Active Server Pages often reinvent the wheel. Their background in web design, with its separate HTML page for each viewable web page on a site, leads many ASP developers to create a distinct ASP page each time they think they need one. Often times, these pages are functionally similar. With intelligent planning, an ASP developer stands to save a great deal of time by creating reusable ASP pages.Designing Active Server Pages is tailor-made for these developers.There is currently a plethora of Active ...

See more details below
Paperback (2000)
$28.62
BN.com price
(Save 18%)$34.99 List Price
Other sellers (Paperback)
  • All (39) from $1.99   
  • New (14) from $8.50   
  • Used (25) from $1.99   
Sending request ...

Overview

Developers of Active Server Pages often reinvent the wheel. Their background in web design, with its separate HTML page for each viewable web page on a site, leads many ASP developers to create a distinct ASP page each time they think they need one. Often times, these pages are functionally similar. With intelligent planning, an ASP developer stands to save a great deal of time by creating reusable ASP pages.Designing Active Server Pages is tailor-made for these developers.There is currently a plethora of Active Server Pages books. However, the vast majority of these books are either technical references or how-to books for beginners. Designing Active Server Pages is written for the intermediate to advanced user. Furthermore, nearly every other book on ASP focuses on using VBScript, even though ASP supports an array of scripting languages, including JScript and PerlScript. Designing Active Server Pages shows how to start using these other languages.The latest version of the scripting engines (Version 5.1 for VBScript) adds new features not available before the 5.0 release. These features include class support for VBScript, and Regular Expression searching through the use of a COM object. Designing Active Server Pages explains why using classes in VBScript is beneficial, and demonstrates the power of regular expression searching.This book shows how to simplify the process by only requiring one ASP page to handle ALL of the Forms throughout a web site, thus reducing the amount of code one has to write.Topics include:

  • Using various Microsoft and third-party components to enhance ASP pages
  • Creating components using VB and/or VC++
  • Sample code for performing routine ASP tasks
  • Techniques to allow for reusable database scripts on the database system and on ASP pages
  • How to obtain and register third-party components, thus saving massive amounts of time by reusing someone else's code
Designing Active Server Pages is for developers who have already mastered the basics of ASP application development and are ready to take the next logical step. It is sure to become an indispensable part of every web developer's library.
Read More Show Less

Editorial Reviews

From Barnes & Noble
Anyone can create one Active Server Page -- but when you're building large-scale applications with ASP, it's just plain inefficient to use yesterday's one-off techniques. You need to design your Active Server Pages, organize them for easy maintenance and reuse. Now you can -- with the one book that brings sanity to ASP development. This book covers every technique you need: dynamic server-side includes, modularization, VBScript classes, reusable administration pages, third-party components, and more.
Booknews
Shows Active Server Pages (ASP) developers how to reuse code by looking for common functionality and by separating the presentation element of web pages from script. Covers areas including scripting blocks or code libraries, developing and using classes, maximizing ASP's language independence by using another scripting language, and creating simple COM components to encapsulate common functionality by using the Microsoft Script Component Wizard. Focus is on ASP 3.0 and VBScript 5.0+. Mitchell is cofounder of an ASP resource on the Internet. Annotation c. Book News, Inc., Portland, OR (booknews.com)
Read More Show Less

Product Details

  • ISBN-13: 9780596000448
  • Publisher: O'Reilly Media, Incorporated
  • Publication date: 9/28/2000
  • Edition description: 2000
  • Edition number: 1
  • Pages: 368
  • Product dimensions: 7.00 (w) x 9.13 (h) x 0.83 (d)

Meet the Author

Scott Mitchell is the co-founder of one of the most popular ASP resource destinations on the Internet, http://www.4guysfromrolla.com/. Originally started as a college project, 4Guys quickly blossomed into a community of serious web developers. The site attracts tens of thousands of experienced ASP developers every day, and unlike other communities, it also offers a warm welcome and advice for those new to Active Server Pages. In addition to 4guysfromrolla.com, Scott has extensive experience building real-world web sites using Active Server Pages, including building an intranet tool for Microsoft's Office Group.

Read More Show Less

Read an Excerpt


Chapter 1: Introduction

As the Web has become a more integral part of everyday life and business, web sites have matured from small, static sites into rich, data-driven, complex applications. Several technologies, including dynamic scripting technologies, like Active Server Pages and Perl, have aided along the way, making the Web a more viable application medium. This book focuses on using Active Server Pages to quickly and easily build powerful and dynamic web sites.

Although the server-side tools for building web sites have experienced a nice maturation, the processes used for building these sites have not. What, specifically, is Active Server Page design? What is currently wrong with ASP design? Why hasn't the art of designing ASP pages advanced? What can be done to improve ASP design? The first three questions will be answered in this chapter. The last one, however, is a meaty one; it is addressed in this chapter, and answered over the next seven chapters.

This chapter not only addresses these questions, but also introduces functions and programming styles that will be used extensively throughout this book.

What Is Application Design?

Designing a single ASP page is trivial. The challenges involved in designing ASP pages arise when large web sites with hundreds of web pages are being crafted. These large web sites are, in their own rights, full-scale applications. Therefore, before we examine Active Server Page design, we will first take a step back and discuss application design. As we'll see shortly, application design is a long, arduous process, involving much more than simply punching out code.

Imagine that you have just been assigned the task of creating a new program that will be deployed to all of the employees in your company. This program will allow the users to query a centralized database and place the results into a number of formats that correspond to various interoffice forms your company uses. What do you do first? How do you get started?

Designing, coding, testing, and deploying an application is known as application development. Temporally, it can be viewed as the time span from when the program was first conceptualized to when its first stable version was available for use. (Of course, application development does not end with the first, stable release of a product. Rather, it continues as long as updates and enhancements of the given product are being made.) An entire branch of the computer science discipline is dedicated to studying various application-development methodologies. While there are a number of different methodologies, they all usually share a certain number of phases, which include:

  • Design
  • Coding
  • Testing
  • Deployment

In classical software development, developers usually follow this flow, working on the application's design before moving on to writing the actual code. For example, large software companies draft very detailed plans for their software projects before a developer writes a single line of code.

Designing for the Web

With the Web, the design stage usually focuses on the aesthetics of the web site, such as the look and feel of each web page. This makes sense, since in the Web's earlier days, the vast majority of web sites were static, their usefulness and allure directly dependent upon their HTML design. As the Web matures, though, and web sites become more dynamic, it is important that adequate time be spent on the design of the scripts that run a site.

Simply put, the design phase in web site development focuses too much on the layout and HTML issues and too little on the programmatic side. That's not to say that HTML design is unimportant: it is very important. The end users benefit directly from the HTML design. Imagine a site that had terrible HTML design, a site cumbersome to navigate and difficult to use. Chances are, after one visit to this site, you'd not come back.

Script design, on the other hand, benefits the developers directly, and the end users indirectly. For example, if your dynamic web site contains robust, easy-to-update scripts, the developers will directly benefit from reduced time spent in the coding phase when a new feature needs to be added. The end users will indirectly benefit from such well-designed scripts, since the less code a developer has to write, the less buggy her code will be. Additionally, well-designed scripts require less maintenance time, making it easier to add new functionality to existing scripts. (The benefits of code reuse and robust scripts are discussed in more detail in the next section, "What's Wrong with ASP Design?") Since both HTML design and script design are important, it is essential that adequate time be spent on both.

Since ASP pages are scripts, ASP design is the art of crafting robust, reusable code. Good design requires planning, documentation, and above all, patience. Before you begin writing code for a particular ASP page, think of what the script needs to accomplish. Is it similar to the functionality of other ASP pages on the site? Have you created a page with similar functionality in a past project? How can you build this page so that it can be easily reused in future projects?

What's Wrong with ASP Design?

In my consulting experience, I have found that many developers don't spend any time working on the design of their scripts. Rather, they just start coding once they have an understanding of what the web site needs to look like and what tasks it needs to accomplish.

Such an approach is inefficient and error-prone. If no thought is dedicated to determining the design of the ASP scripts before they are actually written, then for each similar script, the developer essentially reinvents the wheel. For example, imagine the developer has four ASP scripts that need to make modifications to a database. While these scripts may not be identical, assume they all have many functional similarities. Why should the developer spend the time to create each page separately, when one generic page would do?

There is a direct correlation between the amount of code you write and the number of bugs in your program. Typos and silly mistakes catch us all, and they occur proportionally to the amount of raw source code actually written. If we can reduce the number of total ASP scripts that need to be written by generalizing certain scripts to handle the functionality present in the previous four, we will create less buggy ASP applications.

Furthermore, intelligent ASP script design will not only save time and bugs in our current project, but also in future projects. Once a robust module is written to handle a specific task, if that task needs to be completed in a future project, we need only reuse our existing code! With hasty design techniques, code is often written without looking toward the future...

Read More Show Less

Table of Contents

Preface;
Who This Book Is For;
How This Book Is Organized;
ASP Information on the Web;
Obtaining the Sample Code;
Conventions Used in This Book;
How to Contact Us;
Acknowledgments;
Chapter 1: Introduction;
1.1 What Is Application Design?;
1.2 What’s Wrong with ASP Design?;
1.3 Why Hasn’t ASP Design Advanced?;
1.4 What Can Be Done to Improve ASP Design?;
1.5 Further Reading;
Chapter 2: Choosing a Server-Side Scripting Language;
2.1 The Popularity of VBScript;
2.2 Specifying the Scripting Language;
2.3 Creating ASP Pages with JScript;
2.4 Creating ASP Pages with PerlScript;
2.5 Creating ASP Pages with Python;
2.6 Further Reading;
Chapter 3: Exception Handling;
3.1 A Bit of Terminology;
3.2 Detecting When Exceptions Occur;
3.3 Responding to Exceptions;
3.4 Creating Custom HTTP Error Pages;
3.5 Further Reading;
Chapter 4: Regular Expressions, Classes, and Dynamic Evaluation and Execution;
4.1 Using the RegExp Object;
4.2 Using Object-Oriented Programming with VBScript;
4.3 Using Dynamic Evaluation and Execution;
4.4 Further Reading;
Chapter 5: Form Reuse;
5.1 The Importance of Code Reuse;
5.2 A Primer on Form Use;
5.3 Form Validation;
5.4 Creating Reusable Server-Side Form Validation Routines;
5.5 Developing Reusable Form Creation Routines;
5.6 The Practicality of Reuse;
5.7 Further Reading;
Chapter 6: Database Reuse;
6.1 Examining Database Usage;
6.2 The Building Blocks for Creating Reusable Administration Pages;
6.3 Creating Reusable Administration Pages;
6.4 Further Reading;
Chapter 7: Using Components;
7.1 COM—A Quick Overview;
7.2 Lesser-Known Microsoft COM Components;
7.3 Enhancing Microsoft’s COM Components;
7.4 Building Components;
7.5 Further Reading;
Chapter 8: Enhancing Your Web Site with Third-Party Components;
8.1 Executing DOS and Windows Applications on the Web Server with ASPExec;
8.2 Obtaining Detailed Information About Your Users’s Browsers;
8.3 Grabbing Information from Other Web Servers;
8.4 Encrypting Information;
8.5 Uploading Files from the Browser to the Web Server;
8.6 Why Reinvent the Wheel?;
8.7 Further Reading;
Colophon;

Read More Show Less

Customer Reviews

Be the first to write a review
( 0 )
Rating Distribution

5 Star

(0)

4 Star

(0)

3 Star

(0)

2 Star

(0)

1 Star

(0)

Your Rating:

Your Name: Create a Pen Name or

Barnes & Noble.com Review Rules

Our reader reviews allow you to share your comments on titles you liked, or didn't, with others. By submitting an online review, you are representing to Barnes & Noble.com that all information contained in your review is original and accurate in all respects, and that the submission of such content by you and the posting of such content by Barnes & Noble.com does not and will not violate the rights of any third party. Please follow the rules below to help ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer. However, we cannot allow persons under the age of 13 to have accounts at BN.com or to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the information on the product page, please send us an email.

Reviews should not contain any of the following:

  • - HTML tags, profanity, obscenities, vulgarities, or comments that defame anyone
  • - Time-sensitive information such as tour dates, signings, lectures, etc.
  • - Single-word reviews. Other people will read your review to discover why you liked or didn't like the title. Be descriptive.
  • - Comments focusing on the author or that may ruin the ending for others
  • - Phone numbers, addresses, URLs
  • - Pricing and availability information or alternative ordering information
  • - Advertisements or commercial solicitation

Reminder:

  • - By submitting a review, you grant to Barnes & Noble.com and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Noble.com Terms of Use.
  • - Barnes & Noble.com reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & Noble.com also reserves the right to remove any review at any time without notice.
  • - See Terms of Use for other conditions and disclaimers.
Search for Products You'd Like to Recommend

Recommend other products that relate to your review. Just search for them below and share!

Create a Pen Name

Your Pen Name is your unique identity on BN.com. It will appear on the reviews you write and other website activities. Your Pen Name cannot be edited, changed or deleted once submitted.

 
Your Pen Name can be any combination of alphanumeric characters (plus - and _), and must be at least two characters long.

Continue Anonymously
Sort by: Showing all of 2 Customer Reviews
  • Anonymous

    Posted September 5, 2001

    Bringing some logic into chaos

    Like many people I know in the web design / application business today, I do not come from a traditional programming background. Moving onto the web with HTML and then growing into PHP, Perl, and ASP, I have picked up pieces here and there and am now looking to put some serious logic into my designs, hence I bought the book. Mitchell's book is exactly what it claims to be. His thorough yet not cumbersome explanations, real world code examples, and targeted subject matters have truly helped me to deal with building web applications with a much more logical approach. I'm so sick and tired of books that don't make it clear what you are supposed to get out of them. This book is just the opposite, targeting those things many of us do day in and day out such as database access and validation scripts. By practicing the presented techniques, I have already cut down development time on a couple of projects. This is the type of book I love to see come from O'Reilly. My only gripe is that he hasn't written a similar book using PHP/Apache.

    Was this review helpful? Yes  No   Report this review
  • Anonymous

    Posted October 24, 2000

    Excellent

    If you followed a typical career path into the world of web development, you may be in for a real eye-opener with this book. The primary theme of this book is code reuse. The author, Scott Mitchell, seems to have had extensive experience. I can practically guarantee that this book will convince 90% of developers re-evaluate their website development strategies. Though this book is primary written for ASP, much of the material can be translated to JSP, and possibly even CGI.

    Was this review helpful? Yes  No   Report this review
Sort by: Showing all of 2 Customer Reviews

If you find inappropriate content, please report it to Barnes & Noble
Why is this product inappropriate?
Comments (optional)