Article
· Aug 12, 2016 2m read

NewBie's Corner Session 16 Introduction to New Concepts

NewBie's Corner Session 16 Introduction to New Concepts

Welcome to NewBie's Corner, a weekly or biweekly post covering basic Caché Material.

A number of new concepts are introduced in this session that will be developed more fully in subsequent sessions. It is necessary to at least introduce these concepts here because they are all interrelated.

Older style of MUMPS Programming

A routine has access to all the variables it creates. When Routine-A calls Routine-B and Routine-B calls Routine-C, and so forth, this is known as a Call Stack. All routines in the Call Stack may modify any variable created by any other routine in the Call Stack. All the routines have access to the Variable Pool, A group of variables shared by all routines in the Call Stack.

Scope

What is described above is an older style of MUMPS programming which gives no consideration to scope. Scope is what limits Routine access to variables. Scope is necessary because all routines having access to all variables becomes unwieldy very quickly.

New command

In the older style of MUMPS Programming, the primary method of enforcing scope is the New command. The New command basically creates a new version of a variable that is in effect until the Quit command, then it reverts back to the old value.

Procedures verses Non-Procedures

In years past the only way to program in MUMPS was with Non-Procedures, this was the norm. Only in recent years were Procedures developed. Procedures are a "stepping-stone" (if you will) into programming with Classes where the Procedure concepts are fully realized with Methods.

Calling and Called Routines

In large computer systems, the execution path of code winds in and out of many routines. In this scenario there is the Calling Routine and the Called Routine. And of course, a Routine can be both a Called and Calling routine.

Variables verses Parameters

Variables morph into Parameters when they are passed from the Calling Routine to the Called Routine. There is little that actually changes between variables and parameters, it is just the name that changes.

(Parameters) that are Passed by Value verses those Passed by Reference

When a Parameter is Passed by Value from a calling routine to a called routine, the called routine cannot change the parameters' value. However, with Parameters that are Passed by Reference, the called routine can change its value and pass this new value back to the calling routine.  

The above concepts will be explained in the subsequent sessions.

--Mike Kadow

PaulMikeKadow@gmail.com

If you have a comment, please respond through the InterSystems Developer Community, don't send me private email, unless of course you wish to address me only.

See "Newbie's Corner Index" for an index of all NewBies' Posts

Discussion (0)0
Log in or sign up to continue