[MEDITECH NPR Reports / NPR Report Writing / NPR Report Writer / MEDITECH Report / Non-Procedural Report / NPR Reports / MEDITECH Reports] <a href="http://comstock-software.com">MEDITECH Reports</a>MEDITECH NPR Report Writing: Readable MEDITECH NPR Code

Thursday, March 13, 2008

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.

0 Comments:

Post a Comment

Links to this post:

Create a Link

<< Home

[MEDITECH NPR Reports / NPR Report Writing / NPR Report Writer / MEDITECH Report / Non-Procedural Report / NPR Reports / MEDITECH Reports]