Sabtu, 01 Agustus 2015

Computer Programming Functions: Get to Know What They Are

When it comes to computer programming vocabulary, there are so many terminologies that people who do not have enough know-how tend to become lost and confused.  One term could be translated into so many different names in different languages.  For example, the following words are quite similar: Functions, Programs, Subroutines, Procedures, Subprograms, or Subqueries.  The only question now is which of these terms could stand on their own.

Theoretically speaking, computer programming avoids the duplication of any code in multiple spaces.  For example, one institution utilizing the programs could have some libraries of different thousands or even more programs with billions of basic code lines.  With such intricate case, duplication could still be avoided.  Let us say that an error message occurs because the collection now needs to have an additional ‘member’.

A good example is the addition of another global currency called the Euro.  If each and every program will be told to update itself because of this new addition, it could be complex.  But with sub-programs or functions specifically designed to handle diverse situations, then the only function that would take care of the change would be the one assigned to handle such a scenario.

In the same way that we write new programs, many of the components that it will need are already in existence (e.g. accessing a certain file to dig up a certain data, computing inventories on hand).  In cases such as this, a good alternative to writing different source code lines to work on the new function (and eventually replication of the code onto numerous other programs), the sub-program is accessed to work on the specified function.

In a handful of programming languages, there are certain parameters that are being passed from a specific program name to the program that is being called to do a task.  A secondary program usually makes the values altered and then the control is brought back to the main program.  These actions could be levels deeper.  The various programs that are being used to call each other are written in so many varying languages.  The reasons behind this are:   to have a reasonable controllable function pieces and having various languages means being better able to suit different function types.

To further define the uses of programming functions, a function may appear in two different locations or even a single location.  This depends on whether it is multi-line or single-line function.  A function that is single line is one that gives back a value after performing tasks (all of this in a single line).  The multi-line function, however, is stretched on many different lines.

A single line function could show in a code block all because it only responds when called by a certain name.  The multi-line function does otherwise.  If it is a multi-line function that is being defined in a block of code, then the statements that follow the definition are done in a non-sequential manner.

In its simplicity, functions are code blocks that can be reusable.  These code blocks often return single values (sometimes they don’t’).  Common examples of these code blocks are Mathematical functions (e.g. tan or log), date functions (figures between two dates), or string functions (looking for incidents of 1 string located within another string).  Functions are also kept separately from the primary program code.  A lot of programming language has specific functions which are delegated as entry points to a certain program.

Knowing what functions are in computer programming could take sometime to non-computer savvy individuals.  But the basics are all here.  Looking at the many complex things that functions do, you get to appreciate the things that the computer does for you each day, don’t you?