Star Date 2012.10.14

Download Report

Transcript Star Date 2012.10.14

Historical Perspective
1
1965
2
1 Got Married
2 First Computer Course
3
Got Married
4
5
Got Married
6
7
8
Got Married
9
10
Got Married
11
Got Married
12
First Computer Course
Fortran
13
Fortran
Fortran was only 8 years old
Already Several Versions
Fortran IV
14
One of the Big Issues
HOW DO YOU GET THE PROGRAM
IN THE COMPUTER?
15
Historical Computing
• Computers were very
expensive
16
Historical Computing
• Computers were very
expensive
• Could only run one
program a time
17
Historical Computing
• Computers were very
expensive
• Could only run one
program a time
• So one object was to
get the program into
the computer as fast as
possible
18
A Good Media
• The Punched Card
• Card Readers
19
A Fortran Card
and Key Punch Machine
20
21
22
23
24
IBM 7094
• Fastest Machine
• .35 MIPS
• 32K Memory (36 bit
word)
• Very Expensive
25
26
IBM 7094
• Fastest Machine
• .35 MIPS
• 32K Memory (36 bit
word)
• Very Expensive
• Over 3 Million Dollars
27
28
29
30
31
32
Contract Programmer
• Go from Job to Job
• Sometimes call
ourselves gypsies
• Subject to technical
interviews
33
Technical Interviews
• Contract programmers
• Have to do a lot of
technical interviews
• Level of questions are
often quite simple
34
Technical Interviews
• What PROC do you use
for printing?
35
Technical Interviews
• What PROC do you use
for printing?
• What manual describes
the PROCs?
36
• Once in a discussion about the quality of
questions, a fellow contractor spoke up and
said that the best he ever got was:
SESUG 2012, Durham NC
37
• Can you describe the life cycle
of a software system?
SESUG 2012, Durham NC
38
• This fellow had just reviewed software
• development methods.
• And answer was:
SESUG 2012, Durham NC
Yes
39
Needs analysis
Systems analysis
System design
Unit design
Unit coding
Subsystem coding
System coding
System acceptance
40
Needs analysis
Systems analysis
System design
Unit design
Unit coding
Subsystem coding
System coding
System acceptance
Then it goes forever into
maintenance
41
WOW
42
That is what you might do for a
Huge System
• With dozens of pages of documentation
• If not hundreds
SESUG 2012, Durham NC
43
That is not what we are doing
today!
• For a small ad hoc program
• ONE sheet (keep it simple)
SESUG 2012, Durham NC
44
Needs analysis
Analysis
Design
45
The Request
• Usually an email
• Stating what the requestor wants
SESUG 2012, Durham NC
46
The Request – part 1
• The Marketing Group is planning to do a
telephone survey to determine the interest
level for using solar as part of an individual
household electrical supply. Needed is a
sample of 10,000 customers meeting for
following qualifications:
SESUG 2012, Durham NC
47
The Request – part 2
Qualifications
•
•
•
•
Residential
Household income of at least $75,000
Monthly power usage of at least 2500 Kwh
Live in the metro area
SESUG 2012, Durham NC
48
The Request – part 3
• Needed for each person in the sample:
Name
Address
Telephone number
Age
Solar user
SESUG 2012, Durham NC
49
I build single sheet starting with
three columns
• Item number
• Flag
• User request
50
Spec Sheet
Item
Flag
User request
1
Residential
2
Income level
3
Power usage
4
Metro
5
Name
6
Address
7
Phone Num
8
Age
9
Solar user
51
Note that in the items in the
request fall into two categories:
• Selection criteria (items 1 - 4)
• Needed information (items 5 – 9)
SESUG 2012, Durham NC
52
I use the flag column
• S - selection criteria
• I - needed information
SESUG 2012, Durham NC
53
Spec Sheet
Item
Flag
User request
1
S
Residential
S
Income level
S
Power usage
S
Metro
I
Name
I
Address
I
Phone Num
I
Age
I
Solar user
2
3
4
5
6
7
8
9
54
As Programmers and Analysts
Know
• Now the work begins –
• Finding the needed items (data)
SESUG 2012, Durham NC
55
Identification of data includes:
•
•
•
•
Databases,
Tables,
Variables,
Values for the variables,
SESUG 2012, Durham NC
56
And – Oh Yes
• Specialized routines if needed.
SESUG 2012, Durham NC
57
More columns are needed in the
spec sheet.
•
•
•
•
•
Database (DB)
Table
Variable (Var)
Values
Footnote (FN) {to identify special routines}
SESUG 2012, Durham NC
58
Spec
Sheet
Item
Flag
User request
BK
DB /
Lib
Table
Var
Values
FN
1
S
Residential
S
Income level
S
Power usage
S
Metro
I
Name
I
Address
I
Phone Num
I
Age
I
Solar user
2
3
4
5
6
7
8
9
59
Data discovery time is a luxury that
programmers don’t always have when
starting a new project
60
Large organizations have a lot of
databases and tables to explore.
61
A neophyte programmer or even a
seasoned programmer new on the job can
be challenged to find source locations for
all of the data required on a new report.
62
Imagine walking through the office trying to
network with others about where to find
data.
63
Having a printed copy of a spec sheet
will be helpful to use as a visual aid during
conversations.
64
Fill in what you can on your own
SESUG 2012, Durham NC
65
Spec
Sheet
Item
Flag
User request
BK
DB /
Lib
Table
Var
Values
CQ
bill
tartyp
1
CQ
bill
name
as shown
CQ
bill
serv_ad
CQ
bill
phone
FN
1
S
Residential
S
Income level
S
Power usage
S
Metro
I
Name
I
Address
I
Phone Num
I
Age
I
Solar user
2
3
4
5
6
7
8
9
66
Then Go get Help!
• Before going after help you might pencil in the
names of the most likely people that would
have the answer
• If you do not have a clue leave it blank and ask
every one
SESUG 2012, Durham NC
67
Spec
Sheet
Item
Flag
User request
BK DB /
Lib
Table
Var
Values
bill
tartyp
1
CQ
bill
name
as shown
CQ
bill
serv_ad
CQ
bill
phone
FN
1
S
Residential
2
S
Income level
S
Power usage
S
Metro
I
Name
I
Address
I
Phone Num
3
4
5
6
7
8
I
Age
9
I
Solar user
CQ
BH
LG
BB
C
Do not
have a
clue
68
As you go from person to person
getting answers
• Pencil in the information
SESUG 2012, Durham NC
69
Spec
Sheet
Item
Flag
User request
BK
DB /
Lib
Table
Var
Values
FN
CQ
MON
bill
monthly
tartyp
income
1
7 or above
Use
usage
kwh_nn
ge 2500
CNTY
cnty_cd
county
CQ
bill
name
CQ
bill
serv_ad
3
CQ
bill
phone
4
MON
monthly
age
CQ
bldg
tariff
1
S
Residential
S
Income level
S
Power usage
S
Metro
I
Name
I
Address
I
Phone Num
I
Age
I
Solar user
2
3
4
5
6
7
8
9
1
2
as shown
u1,v1
70
You have a choice
• Use it as is or
• Go back to your work station (computer) and
enter the new information into the sheet
SESUG 2012, Durham NC
71
72
OOPs
• Some one slipped in an old frame
• Were back on the dark ages
SESUG 2012, Durham NC
73
• Put in the updated information and
• Do not forget the footnotes
SESUG 2012, Durham NC
74
Spec Sheet
Item Flag User
1
2
3
4
5
S
S
S
S
I
requirement
Residential
Income level
Power usage
Metro
Name
BK
DB
Table
Var
Values
CQ
MON
Use
CNTY
CQ
bill
monthly
usage
cnty_cd
bill
tartyp
income
kwh_nn
county
name
1
7 or above
ge 2500
6
I
Address
CQ
bill
7
I
Phone num
CQ
bill
8
I
Age
MON
monthly
9
I
Solar user
CQ
bldg
10
I
NO CONTACT
CNT
contact
Footnote 1: average the past 12 months where nn=01…12
Footnote 2: select only metro area counties
Footnote 3: %inc ‘parseAD’
Footnote 4: %inc ‘parsePH’
serv_ad
phone
age
tariff
nocontact
FN
1
2
as shown
3
4
u1,v1
nc,nmnc
75
Do You see any Advantages in
Creating a Spec Sheet?
76
Do You see any Advantages in
Creating a Spec Sheet?
• Structured guide in
finding the data
77
Do You see any Advantages in
Creating a Spec Sheet?
• Structured guide in
finding the data
• Provides a visual when
consulting with coworkers
78
Do You see any Advantages in
Creating a Spec Sheet?
• Structured guide in
finding the data
• Provides a visual when
consulting with coworkers
• Provides a check list
when writing the
program
79
Cross Reference Between Spec Sheet
and Program
Wouldn’t it be good to link each item in the spec
sheet to a location in the program
SESUG 2012, Durham NC
80
Back in the days of Fortran
• We used statements numbers
• In SAS line numbers could work
• Except that when
• Adding or deleting a line
• The line numbers change
SESUG 2012, Durham NC
81
A Better Way
82
Back in my
teaching days
83
Three Block Postulates
• A program consists of blocks
• A block must be entered at the top and exited
from the bottom
• Blocks can be nested
SESUG 2012, Durham NC
84
No Way!
• We are not going to be that rigorous today
• SAS naturally is block structured
• Data steps
• PROCs
SESUG 2012, Durham NC
85
Blocks in SAS
• A block can be as small as one data step or
one PROC
• Or you and group a few together (think about
one function)
SESUG 2012, Durham NC
86
Blocks in SAS
• All you have to do is place a comment before
and after the block (with a number)
• Blocks should be numbered in sequence
SESUG 2012, Durham NC
87
*Block 1;
lines of SAS code
.
.
*End Block 1;
*Block 2;
lines of SAS code
.
.
* End Block 2;
88
Connecting Lines in the Spec Sheet
to the Program
• Simple:
• Just place the block number of the block that
satisfies the requirement in the Block column
(BK) of the spec sheet
SESUG 2012, Durham NC
89
*Block 1;
Proc SQL;
create table grump as
select id, tartyp, name, add, phone
from CQ.bill
where tartyp = 1;
quit;
*Block 2;
lines of SAS code
.
.
* End Block 2;
90
Spec Sheet
Item Flag User
1
2
3
4
5
S
S
S
S
I
requirement
Residential
Income level
Power usage
Metro
Name
BK
DB
Table
Var
Values
1
CQ
MON
Use
CNTY
CQ
bill
monthly
usage
cnty_cd
bill
tartyp
income
kwh_nn
county
name
1
7 or above
ge 2500
1
6
I
Address
CQ
bill
7
I
Phone num
CQ
bill
8
I
Age
MON
monthly
9
I
Solar user
CQ
bldg
10
I
NO CONTACT
CNT
contact
Footnote 1: average the past 12 months where nn=01…12
Footnote 2: select only metro area counties
Footnote 3: %inc ‘parseAD’
Footnote 4: %inc ‘parsePH’
serv_ad
phone
age
tariff
nocontact
FN
1
2
as shown
3
4
u1,v1
nc,nmnc
91
*Block 1;
Proc SQL;
create table grump as
select id, tartyp, name, add, phone
from CQ.bill
where tartyp = 1;
quit;
*Block 2;
Proc SQL;
create table inc as
select id, income, age
from MON.monthly
where income ge 7;
quit;
* End Block 2;
92
Spec Sheet
Item Flag User
1
2
3
4
5
S
S
S
S
I
requirement
Residential
Income level
Power usage
Metro
Name
BK
DB
Table
Var
Values
1
2
CQ
MON
Use
CNTY
CQ
bill
monthly
usage
cnty_cd
bill
tartyp
income
kwh_nn
county
name
1
7 or above
ge 2500
1
6
I
Address
CQ
bill
7
I
Phone num
CQ
bill
8
I
Age
2
MON
monthly
9
I
Solar user
CQ
bldg
10
I
NO CONTACT
CNT
contact
Footnote 1: average the past 12 months where nn=01…12
Footnote 2: select only metro area counties
Footnote 3: %inc ‘parseAD’
Footnote 4: %inc ‘parsePH’
serv_ad
phone
age
tariff
nocontact
FN
1
2
as shown
3
4
u1,v1
nc,nmnc
93
Spec Sheet
Item Flag User
1
2
3
4
5
S
S
S
S
I
requirement
Residential
Income level
Power usage
Metro
Name
BK
DB
Table
Var
Values
1
2
3
4
1
CQ
MON
Use
CNTY
CQ
bill
monthly
usage
cnty_cd
bill
tartyp
income
kwh_nn
county
name
1
7 or above
ge 2500
6
I
Address
5
CQ
bill
7
I
Phone num
6
CQ
bill
8
I
Age
2
MON
monthly
9
I
Solar user
7
CQ
bldg
10
I
NO CONTACT 8
CNT
contact
Footnote 1: average the past 12 months where nn=01…12
Footnote 2: select only metro area counties
Footnote 3: %inc ‘parseAD’
Footnote 4: %inc ‘parsePH’
serv_ad
phone
age
tariff
nocontact
FN
1
2
as shown
3
4
u1,v1
nc,nmnc
94
You have a choice
• Use it as is or
• Go back to your work station (computer) and
enter the new information into the sheet
SESUG 2012, Durham NC
95
96
What are the advantages?
• Provides a guide for program review
SESUG 2012, Durham NC
97
What are the advantages?
• Provides a guide for program review
• Acts as an index into the program
SESUG 2012, Durham NC
98
What are the advantages?
• Provides a guide for program review
• Acts as an index into the program
• Enables any programmer to quickly become
familiar with the existing SAS code
SESUG 2012, Durham NC
99
What are the advantages?
• Provides a guide for program review
• Acts as an index into the program
• Enables any programmer to quickly become
familiar with the existing SAS code
• Easier to work on program modifications
SESUG 2012, Durham NC
100
Features Matrix
101
Features Matrix
• Have you every ask yourself the question:
Where have I done this before?
SESUG 2012, Durham NC
102
Features Matrix
• Have you every ask yourself the question:
Where have I done this before? or
• Hmmm: In which program did I do this?
SESUG 2012, Durham NC
103
Features Matrix
• There is a relatively simple solution
SESUG 2012, Durham NC
104
Features Matrix
• There is a relatively simple solution
• But you do have to spend a few minutes
during or after each program
SESUG 2012, Durham NC
105
Features Matrix
• There is a relatively simple solution
• But you do have to spend a few minutes
during or after each program
• Build a features matrix
SESUG 2012, Durham NC
106
Features Matrix
• Build a two dimensional matrix consisting of:
• Major Features versus
• Program Titles
SESUG 2012, Durham NC
107
CQ
MON
USE
CNTY
CNT
%inc ‘parseAD’
%inc ‘parsePH’
No contact
code
Ave power
code
PROC
IMPORT
PROC
EXPORT
S
O
L
A
R
G
R
E
E
N
B
U
S
I
N
E
S
S
S
A
M
P
L
E
I
N
D
U
S
T
R
A
L
S
A
M
P
L
E
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
S
I
N
G
L
E
F
A
M
I
L
Y
H
O
M
E
S
W
A
T
E
R
H
E
A
T
E
R
T
Y
P
E
S
P
A
P
E
R
L
E
S
S
C
A
M
P
A
I
G
N
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
O
U
T
D
O
O
R
L
I
G
H
T
I
N
G
X
X
A
U
T
O
D
E
A
L
E
R
S
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
108
Flower Box
109
Flower Box
• flower box (plural flower boxes)
1. A container in which flowers or plants are
grown, usually affixed outside just below a
window.
SESUG 2012, Durham NC
110
Flower Box
flower box (plural flower boxes)
1. A container in which flowers or plants are
grown, usually affixed outside just below a
window.
2. (computing, programming) A comment in
source code that spans several lines, each of
which begins with an asterisk.
SESUG 2012, Durham NC
111
\******************************************/
\****************************************/
\**************************************/
\************************************/
\**********************************/
\********************************/
112
/********************************************/
/*
*/
/*
*/
/*
*/
/*
*/
/*
*/
/*
*/
/********************************************/
113
/***********************************************/
/*
*/
/*
Program: Solar and Green
*/
/*
*/
/*
Objective: Produce a survey list */
/*
*/
/* Program Path: S:\ad hoc
*/
/*
\Solar and Green\Programs
*/
/*
*/
/*
Author: Robert McCurdy
*/
/*
Date: 25AUG
*/
/***********************************************/
114
What should go into the Box
• Name of the program
• Brief statement of
objective
• Path where the
program is stored
• Path where the data is
stored
• Input
• Output
• Prerequisite programs
which need to be
executed (if any)
• Hard coded dates or
other parameters which
may need to be
changed (show block
numbers)
• Author
• Date written
115
Continued
• Called programs (if any)
• Data preparation (if
any)
116
Take time to smell the flowers
• Go home and plant
some flowers
• Or take some flowers to
someone you care
about
117
The End
118
Contact Information
• [email protected]
119