good programming practice and its importance in the new ... · 3 the metadata world § databases...

15
1 Good Programming Practice and Its Importance in the New World of Metadata Jennifer Chin PhUSE GPP Board

Upload: others

Post on 06-Aug-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Good Programming Practice and Its Importance in the New ... · 3 The Metadata World § Databases contains key words, titles, dataset names and variable names § Metadata can be used

1

Good Programming Practice and Its Importance in the New World of Metadata

Jennifer Chin

PhUSE GPP Board

Page 2: Good Programming Practice and Its Importance in the New ... · 3 The Metadata World § Databases contains key words, titles, dataset names and variable names § Metadata can be used

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

Page 3: Good Programming Practice and Its Importance in the New ... · 3 The Metadata World § Databases contains key words, titles, dataset names and variable names § Metadata can be used

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

Page 4: Good Programming Practice and Its Importance in the New ... · 3 The Metadata World § Databases contains key words, titles, dataset names and variable names § Metadata can be used

4

The Metadata World

Page 5: Good Programming Practice and Its Importance in the New ... · 3 The Metadata World § Databases contains key words, titles, dataset names and variable names § Metadata can be used

5

The Metadata World

Page 6: Good Programming Practice and Its Importance in the New ... · 3 The Metadata World § Databases contains key words, titles, dataset names and variable names § Metadata can be used

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

Page 7: Good Programming Practice and Its Importance in the New ... · 3 The Metadata World § Databases contains key words, titles, dataset names and variable names § Metadata can be used

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

Page 8: Good Programming Practice and Its Importance in the New ... · 3 The Metadata World § Databases contains key words, titles, dataset names and variable names § Metadata can be used

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

Page 9: Good Programming Practice and Its Importance in the New ... · 3 The Metadata World § Databases contains key words, titles, dataset names and variable names § Metadata can be used

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

Page 10: Good Programming Practice and Its Importance in the New ... · 3 The Metadata World § Databases contains key words, titles, dataset names and variable names § Metadata can be used

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

Page 11: Good Programming Practice and Its Importance in the New ... · 3 The Metadata World § Databases contains key words, titles, dataset names and variable names § Metadata can be used

11

Examples

Page 12: Good Programming Practice and Its Importance in the New ... · 3 The Metadata World § Databases contains key words, titles, dataset names and variable names § Metadata can be used

12

Examples

Page 13: Good Programming Practice and Its Importance in the New ... · 3 The Metadata World § Databases contains key words, titles, dataset names and variable names § Metadata can be used

13

Reminder of Key GPP Concepts

DO Don’t

Programheader Overwritedatasetnames

Structuredprogram Writeverylongdatasteps

Informa;vecomments UseSQLexcessively

Indentconsistently Hardcode

Usedefensiveprogrammingcode

TurnofffulldisclosureofERRORS

UsemacrosandSQLwhenappropriate

ManuallyeditLOGorOUTPUT

Page 14: Good Programming Practice and Its Importance in the New ... · 3 The Metadata World § Databases contains key words, titles, dataset names and variable names § Metadata can be used

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

Page 15: Good Programming Practice and Its Importance in the New ... · 3 The Metadata World § Databases contains key words, titles, dataset names and variable names § Metadata can be used

15

Questions