WebMeditechBulletin.com
E-mail
Wednesday, 01 October 2008 07:00

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

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

Readable code costs less than code that is hard to read. If you can’t read the code, you can’t easily identify: errors in logic (aka bugs), ways to reorganize it or change it to meet enhancement requests. Readable code on the other hand allows you and your programmers to understand and repurpose the code. Let’s say that you get a new report request this morning, if your NPR report dictionary is full of unreadable code, you’ll likely write the new report from scratch. New code can mean programming the same types of routines over and over unnecessarily and worse … new bugs. If your reports are written in a readable format, you will no doubt, check them first and copy the reusable, common routines into the new report.

One thing that contributes to unreadable code is the standard DO Loop; almost every NPR macro has one. By using the technique below, you’ll improve the readability of a large percentage of your NPR reports.

Let us examine a standard DO Loop. Notice the code runs off the page. You can’t just open the macro, read the code and move on. This is not readable code.

Examine with me the Reverse DO Loop. If this is your first look at a Reverse DO Loop, it takes a little getting used to, before you can read this in a second or two. Learning to read a Reverse DO Loop is a skill and therefore something you grow more comfortable with as you do it. Reference this article: http://comstock-software.com/blogs/npr/2008/08/npr-do-loops.html for the detailed walk thru on a Reverse DO Loop.

By writing readable code, you’ll 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. John hosts the ‘Meditech NPR Report Writing’ blog at http://nprguy.com/blogs/npr/ where you can learn and read more about NPR Report Writing.

 
Copyright © 2010 Systems Personnel - "Your Partner in Healthcare Search & Consulting"
MeditechBulletin.com and MeditechCareers.com are not affiliated with MEDITECH, Inc.
Get Adobe Flash player