|
| Saturday, 01 November 2008 07:00 |
|
Tricks of the Trade: Writing Readable MEDITECH NPR Macros (Part 2 of 3) Contributed by: John Sharpe, President, Comstock Software, Inc. In Part 1 of this series, we put the standard DO Loop under the microscope and found a way without changing the function of the code, to make it readable at first glance. Restructuring the standard DO Loop into a Reverse DO Loop, improved our ability to see all the code at once in the NPR Macro Editor. In Part 2, the macro in question has been implemented with a Reverse DO Loop; but in spite of our initial effort, the code still runs off the screen. Let’s see what can be done to improve the readability of the code at first glance. As you can see, our visibility is limited to 92 characters in the NPR Macro Editor.
Let’s see if we can regain real estate on the screen, by replacing the conditions in the Reverse DO Loop with new subroutines. Let’s call the subroutines: URN.PRV & DT.PRV.
Next...we’ll make the following changes to the conditions in the DO Loop.
In review, we’ve implemented new subroutines to regain valuable real estate. Now that the code is readable in a single glance, the next programmer will be able to step in quickly and make the required changes in a timely manner. 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. Keep learning. Your new level of productivity is the new standard that will be expected from now on. John Sharpe is President / NPR Consultant at Comstock Software, Inc. Learn more about NPR Report Writing at the MEDITECH NPRReport Writing Blog. |
MeditechBulletin.com and MeditechCareers.com are not affiliated with MEDITECH, Inc.







