Using functions in coral is very useful when creating programs that require their specific input. Using the current case where the manager does not need to waste time creating a coral program to send pictures, breaking the program together with the algorithms used is necessary. This shows the first advantage of using functions rather than modular programming (Cawkwell et al., 2018). The program can be split into small parts that can be managed by several people, making it easy for the program to be handled by several individuals. Secondly, debugging a program created using functions is easy because the program code is independent and composed of subprograms. Thirdly, using functions in a program is suitable, especially when avoiding repetitions. There are cases where a code has to be repeated on various program sections when using modules. However, with function, the codes require only to be called, and it performs the required task in the program. Lastly, using libraries makes it easy for program functions to be used in several programs.
Responding to Nyeshia’s post, there are six key components of a function in coral. These include modifiers, return type, method name, the list of parameters in parenthesis, the exception list, and the body of the method enclosed in braces. Firstly, the modifier declares whether the program code is private or public. Secondly, the return type determines the value or output displayed by the function; this can be void when the function lacks the value to be returned. Thirdly, the method name provides the field names rules that are applied to the function (Cawkwell et al., 2018).
Fourthly, the list of parameters in parenthesis is a list of parameters inputted in a comma-delimited format enclosed within parenthesis. The data types are before the list, and empty parenthesis is used when the parameters are missing. Fifthly the exception list is used when exclusion is required in a program function. Lastly, the body of the function enclosed in braces provides the location for the codes and the local variables.
Reference
Cawkwell, R., Miller, S., Austin, J., & Bowers, M. (2018). Coral Programming Language Reference Manual. Web.