The Winning Way

Download Report

Transcript The Winning Way

Seattle
The Winning Way
Orlando
June 22, 2002
The Winning Way!
1
Topics
• Team roles and responsibilities
• Application requirements
• Our approach
–
–
–
–
June 22, 2002
What to do when
Who does what
Productivity tips
Our solution architecture
The Winning Way!
2
Application Requirements
• Maintain a database
• Use forms
• Use Cascading Style Sheets
• Display data from your database
June 22, 2002
The Winning Way!
3
Our Overall Strategy
• Have consistency across the application
• Use standard components/design we have provided in class
• Use the same architecture for each page
• KISS - Keep It Simple, Stupid!
June 22, 2002
The Winning Way!
4
Team Roles
• Database Administrator
• Team Leader
• Guide review of problem statement
• Using Access, define databases, tables, and fields
• Insure team understands problem statment
• Place database in project db directory
• Manage development schedule
• Create 4-5 test records
• Validate implementation
• Validate database maintenance operations
• Serve as team spokesperson, "emcee"
• Designer
• Developers (2)
• Draw web site architecture
• Review web site and web page architectures
• Draw web page architecture
• Implement ASP
• Review architecture with team
• Solicit/integrate components
• Review sit/pages for architecture compliance
June 22, 2002
The Winning Way!
5
Our Project Development Approach
- Getting the Job Done at Nationals -
Build & Test
Skeleton
Pages
Complete
Web Pages
(ASP Pages)
Build and Test
Style Sheets
Design & Code
Database
Total Work To Be Done
Design
Web Site
Read/
Analyze
Build and Test
Functions/Subroutines
9:00 AM
June 22, 2002
Perform
Initial Validation
5:00 PM
The Winning Way!
Perform
Final Validation
6
Development Time Table
Task
Leader/Performer
Duration Stop
Read, analyze, discuss
Team Leader
30 Min
09:30 AM
Design database
Database
Designer
Designer
30 Min
10:00 AM
30 Min
10:30 AM
Build & test skeleton
pages
Build & test
subroutines
Complete web pages
Developer(s)
30 Min
11:00 AM
Developer(s)
2 Hours
01:00 PM
Developer(s)
2 Hours
03:00 PM
Perform initial
validation
Build and test CSS
Team Leader
30 Min
03:30 PM
CSS Expert
30 Min
04:00 PM
1 Hour
05:00 PM
Design web site
Perform final validation Team Leader
June 22, 2002
The Winning Way!
7
Things That Will Eat Your Lunch
• Data validation
• Password validation
• Error checking
• Style
• None of these have anything to do with content
• Get your application working before dealing with these
June 22, 2002
The Winning Way!
8
Three Important Tips to Employ
- Improving Your Productivity -
• Do NOT use default pages
• Allow directory browsing
• Use the DOS edit to find line number
June 22, 2002
The Winning Way!
9
Web Site and Web Page
Architecture
June 22, 2002
The Winning Way!
10
Generic Web Site Architecture
- Web Page Interaction -
default.asp
supplier.asp
Home Page
Database Table
Management
Page
maintain_supplier.asp
Add/Revise/Delete
Form
supplier_report.asp
Report Page
June 22, 2002
The Winning Way!
11
Database Management Architecture
- Data Flow -
Add/Revise/Delete Request
default.asp
maintain_supplier.asp Form Data
Add/Revise/Delete
Form
Blank form request
Database Table
Management
Page
Database Table
Management
Page
report request
Supplier Table
(gb_supplier)
supplier.asp
• Show for delete request
• Show for revise request
supplier_report.asp
Report Data
June 22, 2002
The Winning Way!
Report Page
12
Sending Information to Your ASP Page
Your ASP Page
Form
Form Data
request.form("fieldname")
request.querystring("fieldname")
Form
Data in URL
Web Page
Data in URL
June 22, 2002
The Winning Way!
13
Sending Variable Data Via the URL
With address or anchor tag:
<A HREF="mypgm.asp?fld1=value1&fld2=value2”>GoHere</A>
HREF="mypgm.asp">GoHere</A>
HREF="mypgm.asp
? fld1=value1&
">GoHere</A>
With forms using "POST"
<FORM NAME=formname METHOD="POST" ACTION="mypgm.asp">
ACTION="mypgm.asp?fld1=value1&fld2=value2">
With forms using "GET"
<FORM NAME=formname METHOD="GET" ACTION="mypgm.asp">
<INPUT TYPE=TEXT NAME=fld1 VALUE="value1" SIZE=9>
<INPUT TYPE=TEXT NAME=fld2 VALUE="value2" SIZE=9>
In all these cases:
Resulting URL is: mypgm.asp?fld1=value1&fld2=value2
Retrieve fields using: request.querystring("fieldname")
June 22, 2002
The Winning Way!
14
Standard ASP Page Pattern
<% Option Explicit %>
Include Files
Page-unique functions and subroutines
Initial static HTML
<HTML>
<HEAD>
<LINK ... >
</HEAD>
<BODY>
<%
Call GBHead()
The guts of the page
... Page-unique material ...
Call GBFoot()
%>
Final static HTML
</BODY>
</HTML>
June 22, 2002
The Winning Way!
15
Standard ASP Page for BDPA Northwest
- No Database Requirements const.inc
<% Option Explicit %>
Include Files
head_n_foot.inc
Page-unique functions and subroutines
Initial static HTML
<HTML>
<HEAD>
<LINK ... >
</HEAD>
<BODY>
css.htm
<%
Call GBHead()
The guts of the page
... Page-unique material ...
mytable.asp
Hyperlink
Call GBFoot()
%>
Final static HTML
</BODY>
</HTML>
June 22, 2002
The Winning Way!
16
Standard ASP Page
- With Database Requirements adovbs.inc
<% Option Explicit %>
const.inc
Include Files
db_procs.inc
head_n_foot.inc
Page Unique Subroutines
Initial static HTML
<HTML>
<HEAD>
<LINK ... >
</HEAD>
<BODY>
css.htm
<%
Call GBHead()
The guts of the page
Dependent on page requirements
Call GBFoot()
%>
Final static HTML
</BODY>
</HTML>
June 22, 2002
The Winning Way!
17
Form Page Standard Layout
STANDARD HEADER
• Form Explanatory Text
• Form title
• Brief instructions
• Response area if "echoing" results of prior action
• Form Data
• All visible and hidden fields
• Action buttons
Add
Revise
Delete
Reset
STANDARD FOOTER
June 22, 2002
The Winning Way!
18
Report Page Standard Layout
STANDARD HEADER
• Report Title
• Report Column Headings
• Report Data and Action Requests
Column1
aaa
bbb
ccc
...
etc
Column2
111
444
396
...
Use <TABLE> tags
Column3 ...
blah
foo
bar
...
Action
Revise Delete
Revise Delete
Revise Delete
Revise Delete
• Report request form
• Show starting and ending range
For FieldA >= ____ and FieldA <= ____
Run Report
STANDARD FOOTER
June 22, 2002
The Winning Way!
19
The Dictionary Object
• A "container" containing a set of key/value pairs
• Create as a scripting object
set form_fields = CreateObject(Scripting.Dictionary)
• Add to it via "add" method
form_fields.add fieldname, request.form(fieldname)
• Retrieve via "For" loop
For each fieldname in form_fields
oInput_rs(fieldname) = form_fields(fieldname)
Next
June 22, 2002
The Winning Way!
20
Database Procedures
- OpenDB and AddRec -
• OpenDB(filename)
• Function called with database's filename
• Calls the error subroutine
• Return value is a DB Connection
• Addrec(oInput_rs, oConnection, form_fields)
• Adds a single record
• Field values for fields comes from form_fields
form_fields
fld1
fld2
fld3
fld4
valu1
valu2
valu3
valu4
Addrec
Uses
Creates
oConnection
oInput_rs
June 22, 2002
valu1 valu2 valu3 valu4
The Winning Way!
21
Database Procedures
- ReviseRec and DeleteRec• Revrec(oInput_rs, oConnection, form_fields)
• Revises a single record
• Field values for fields comes from form_fields
form_fields
fld1
fld2
fld3
fld4
valu1
valu2
valu3
valu4
Addrec
Uses
Creates
oConnection
oInput_rs
valu1 valu2 valu3 valu4
• DeleteRec(oConnection, tablename, fieldname, id)
• Deletes one or more records
• Deletes all records with a matching id
• "id" is a value
• 'fieldname" is the name of a field (doesn't have to be a key field)
June 22, 2002
The Winning Way!
22
maintain_<tablename>.asp
-Psuedo code If user requested it,
Send a blank form back to the user
else, if requested via the report page,
create a form for revising or deleting a record
else, if this is an add request,
create record set
get data from the form
add record to the record set
echo back to the user what you added
else if delete request
get record id from the form
get record from database and put in record set
echo to the user, data from the about-to-be-deleted record set
delete the record
else if revise request
get data from form
get record from database and put in record set
revise record
echo back to the user, the record you revised
end if
June 22, 2002
The Winning Way!
23
EXTRA SLIDES
June 22, 2002
The Winning Way!
24
Team Exercise
• Find a partner you don't know or didn't introduce earlier
• Answer the questions:
– Who or what is your:
•
•
•
•
•
June 22, 2002
Hero
Favorite author
Favorite movie star
Favorite singer or musician
Most embarrassing moment
The Winning Way!
25
So Where's the Beef?
• What will make our web sites special?
– They will work!
– Tune in next week for "Advanced Topics"
• What will differentiate Olympia from Seattle?
– Architecture is a (common) framework
– Fleshing out web page to meet specific requirements
– Style
June 22, 2002
The Winning Way!
26