Posted by Winnie Melda on January 8th, 2019
Subroutines and control abstraction
Control abstraction refers to associating a particular name to perform a specific action by presenting information which has been referenced. It is applied in designing and maintaining large software systems. Subroutines are principle mechanisms in programming and usually implement a specific operation on behalf of calling the function. It helps the programmer in encapsulating codes behind a narrow interface. In programming, subroutines are written within parameters containing arguments called actual parameters. There are two types of subroutines; subroutines that return a value (functions), and subroutines that do not return a value (procedure). Some programming languages require subroutines to be declared before using them such as C, Fortran, and LISP
When a given routine is called, it is usually given a new stack containing frames. Each frame contains a compiled procedure as well as storage spaces to store arguments, local variables, and bookkeeping information.
Calling sequence is responsible for maintaining subroutine call stack. The tasks accomplished by maintaining it includes; passing parameters, saving the return address, changing the program counter as well as stack pointer to allocate space. It also involves saving registers that contain important values as well as registers that may be overwritten by one called, changing the frame pointer so that it can refer to the new frame, and execute initialization code for all objects in within the new frame that require it.
Two types of parameter passing modes include call by value and call by reference. Call by value is where actual parameters are assigned to corresponding formal parameters while call by formal reference parameters defines a new name in the body of a subroutine for corresponding actual parameters.
Generic subroutines and modules
Subroutines usually provide ways of performing a variety of different objects especially in large programs where queues, memory, file buffer among others are used to hold processes. The static declaration is required to implement enqueue and dequeue subroutines. Subroutines such as implicit parameter polymorphism allow declaring subroutines whose parameter types are incomplete. Creating valuable containers require programmers to declare classes of particular valuables.
It is a usual or unexpected condition that arises during program execution and cannot be handled in local context. It is usually detected automatically by a program, or a program may raise it explicitly. Exceptions include run-time errors. Exception handling techniques address error issues by moving error-checking code out of line thus allowing the normal case to be interpreted easily. It enhances the controls to branch to a specific exception handler when appropriate. Exception handling includes an executable statement of the form
Co-routines is a general abstraction which is represented by a code, address and referencing environment. It facilitates jumping to other statements using nonlocal go-to statements using a special operation called transfer. The difference between continue control abstraction and Co-routine is that co-routine usually changes during run time. Using a go-to in a continuation, old program counter gets lost. However by explicitly creating a new continuation to hold it is usually retained. By transferring go-to from one co-routine to another, the old program counter gets saved while the co-routine left updated to reflect the program.
It is something in which a running program requires to respond when it occurs especially outside the program within unpredictable time. Most common events include inputs to graphical user interfaces (GUI) such as mouse motions, keystrokes, networked operations and other I/O activities and button clicks among others.
Sherry Roberts is the author of this paper. A senior editor at MeldaResearch.Com in online nursing papers if you need a similar paper you can place your order from medical essay writing service online.
Like it? Share it!
About the AuthorWinnie Melda
Joined: December 7th, 2017
Articles Posted: 364
More by this author