good programming practice and its importance in the new ... · 3 the metadata world § databases...
TRANSCRIPT
1
Good Programming Practice and Its Importance in the New World of Metadata
Jennifer Chin
PhUSE GPP Board
2
Contents § The metadata world § What are the challenges?
§ What actions can we take? § What difference can they make?
§ Examples
§ Reminder of Key GPP concepts § Summary
3
The Metadata World
§ Databases contains key words, titles, dataset names and variable names
§ Metadata can be used to auto-generate programs
§ Auto generated programs - May call other macros to perform tasks
- May be updated to address data specific issues - May need to be validated
- Will need to be maintained
§ Metadata will change
4
The Metadata World
5
The Metadata World
6
What are the challenges?
§ Metadata changes mid project § Updates required when some studies are already
complete
§ Data issues needs to be addressed
§ Programs used across the globe by programmers of varying skill levels
§ Future proof, updates to the meta data should continue to provide good quality programs
7
What are the challenges?
§ Easy to review and update programs if you have written them or they are well written
§ Knowledge of data and program will be limited as the metadata will most likely be populated by someone else
§ Time taken to review the program - Is it using the correct data - Is the output correct
- Are there any data issues requiring investigation
8
What actions can we take?
§ Define clear specifications § Generic macros generate programs that follow GPP:
- Header: who write it, why, anything special
- Structured program: input, process, output
- Comments: explain what the next part of the program does and why, relate to the specification
- Datasets: use meaningful name, do not overwrite, use different names
- Indent: use consistent spacing
9
What actions can we take?
§ Train individual to improve their SAS skills
§ Provide clear and easy to follow guidelines for programming e.g PhUSE GPP guideline http://www.phusewiki.org/wiki/index.php?title=Good_Programming_Practice_Guidance
§ Ensure GPP is implemented in auto-generated programs
§ Improve quality of our programs so that they are easy to read, understand and maintain over time
10
What difference can they make? § Improve CLARITY and READABILITY § Improve QUALITY and RELIABILITY - Defensive programming
- Structured validation process
§ Easy to MAINTAIN and UPDATE - Informative comments
- Use of macros for common processes
§ Driving STANDARDS and CONSISTENCY
§ Complete TRACEABILITY and TRANSPARENCY § Enforcing BUSINESS RULES
- data integrity and usability
- program re-usability
11
Examples
12
Examples
13
Reminder of Key GPP Concepts
DO Don’t
Programheader Overwritedatasetnames
Structuredprogram Writeverylongdatasteps
Informa;vecomments UseSQLexcessively
Indentconsistently Hardcode
Usedefensiveprogrammingcode
TurnofffulldisclosureofERRORS
UsemacrosandSQLwhenappropriate
ManuallyeditLOGorOUTPUT
14
Summary
§ Following GPP generates programs that are: • Structured, so easy to read and maintain over time
• Easy to validate
• Easy for regulatory to review
§ Use GPP when using metadata to auto-generate programs
§ PhUSE Wiki for guideline and more details:
http://www.phusewiki.org/wiki/index.php?title=Good_Programming_Practice_Guidance
15
Questions