WANT the MEDITECH Reports BLOG via EMAIL?

Your email:

About MEDITECH Reports

View John Sharpe's profile on LinkedInI'm your host, John Sharpe, a MEDITECH Report Writing Consultant living in Spokane, WA. Read more ...

Connect ...

Expand your network by connecting on these social media sites:

Sign up for the MEDITECH Reports Blog; details to attend MEDITECH workshops are sent out 1 week in advance to all MEDITECH Report blog subscribers.

These MEDITECH Workshops are sponsored by Donna Carroll at the MEDITECH Community Bulletin

MEDITECH NPR & RW RESOURCES:

Ascii Table: For NPR Report Writer
Loop Builder: For NPR Macros
Key Codes: For CDS Attributes
List Builder: For NPR Macros
MT Report Names: For NPR Reports
MT Structure Viewer: For Physicals
Strings: Format & Sort

HIT Topics

MEDITECH Reports

Current Articles | RSS Feed RSS Feed

Readable MEDITECH NPR Code

  
 

Today's topic is related to a recent post titled Meaningful Arrays The Easy Way which focused on improving the readability of NPR code. Reading Steve Litt's article Code Readability Throughout The Ages I had to reflect on what I've been learning in the past few weeks. I've been learning that Client Server really lends itself to code readability because you can assign values to subroutines:

@ACCOUNTS.PER.USER+1^@ACCOUNTS.PER.USER

ACCOUNT.PER.USER
/ACCOUNTS[@USER]

USER
IF{/USER;"SOME.OTHER.VALUE"}

While MAGIC doesn't allow us to assign to subroutines, we still benefit from the use of subroutines in our efforts to improve the readability of the code.

IF{@TXN.IS.CHARGE @GET.CHARGE.SECTION;
" "}^/MV.TXT,@WRITE.TO.MV

TXN.IS.CHARGE
@BAR.PROC.type[@item.procedure]="CHG"

WRITE.TO.MV
/MV.TXT^/R.MV[/MV.NAME,/LINE,@FIELD],""^/MV.TXT

FIELD
/FN+1^/FN

Without using a single comment, the intent of the code is clear. The next programmer will be able to read and follow along with ease. Properly named subroutines are not only more readable, they're also re-usable resulting in less code. Less code ... fewer bugs. Fewer bugs ... happier customers.

Want an alert when the next post is published? Click the phone and Subscribe to the MEDITECH Reports Blog!

Subscribe to the Meditech Blog     

                                                                                                                                                                                                          

Comments

Currently, there are no comments. Be the first to post one!
Post Comment
Name
 *
Email
 *
Website (optional)
Comment
 *

Allowed tags: <a> link, <b> bold, <i> italics