E-mail
Monday, 01 December 2008 07:00

Tricks of the Trade: Writing Readable MEDITECH NPR Macros (Part 3 of 3)

Contributed by: John Sharpe, President, Comstock Software, Inc.

This is Part 3 in a series on ‘Writing Readable Meditech NPR Macros’. In Part 1 and Part 2 of this series, we examined ways to fit more code on the screen within the confines of the Meditech Macro Editor. When the code fits on the screen, programmers can read and understand the code quickly.

In examining the program below, we can learn a lot. The program does include great documentation on how to use the program. But the actual code will take a new member of the team a while to read and understand before they can maintain or improve it.

While the code doesn’t take up a lot of space and all fits on the screen; it isn’t something that can be quickly understood by another human either. Breaking the routine down into smaller blocks with descriptive subroutines can immediately clear up any ambiguity about the overall purpose of the code.

The program’s intent can be further clarified via the use of descriptive variables. Comments can be used sparingly to clarify the function of the code.

In review, this program included great documentation on how to use the program; but from a maintenance perspective, the program’s code was difficult to read and understand in a timely manner. Breaking the program down into well named sub-routines, using clearly named variables and adding a few well placed comments made this program more readable and understandable for the next programmer.

Now that the code is readable and understandable in a short period of time, the next programmer on the team will be able to step in quickly and make the required changes in a timely manner. And the original programmer will be able to move on to more challenging projects.

By writing readable code, you and your team will be more productive and your MEDITECH users will love you for your responsiveness to their needs.

John Sharpe is President / NPR Consultant at Comstock Software, Inc. Learn more about NPR Report Writing at the MEDITECH NPRReport Writing Blog.

 
Copyright © 2012 Systems Personnel - "Your Partner in Healthcare Search & Consulting"
399-meditechbulletin.com and MeditechCareers.com are not affiliated with MEDITECH, Inc.