EGL Development User Group - Group home

Using “Extract EGL Function” to make the EGL function short and better to understand

  

Usually, if a  function contained too many lines and complex logic,this function will be hard to understand and maintain. so that, someone introduces  theory to guide on how to split these statements of long lines function  into smaller functions. So that the program will be easier to understand and maintain. This theory is called “Extract Method”, which is a very important part of refactoring theory.  To better support this theory, some of IDE provide the “Extract Method” feature for programmers to extract method automatically, like JDT for Java language. In RBD 9.0, we will also provide the “Extract EGL Function” feature, which is similar to JDT for Java language.

Steps to use “Extract EGL Function”:

 

Step 1>Fully select the EGL statements in an EGL function.image

Step 2>Right click the selected statements and select Refactor>Extract Function.image

Step 3>Input the function name and select Access modifier in the pop-up wizardimage

Step 4(Optional)>You can use preview to see the extracted result.image

Step 5>Click OK to finish the extract function.image

Scope for “Extract EGL Function”:

  • The selected statements should be in EGL function or EGL Top Level function.
  • Statements should be fully selected. In other word, you can’t use this feature when only part of a statement was selected, including block statements: For/While/GoTo&Label etc. .
  • This feature can’t be used in Interface/Record/External Type/Form, etc. which is not logical part.
  • This feature can’t be used in part variable definitions.
  • This feature can’t be used when the EGL file contains compiler errors.
  • Selected statements can’t include “return”
  • Selected statements can’t include “continue” when its parent “while”,”For”,”Foreach” is not full selected.
  • Selected statements can’t include “exit” when its parent “case”,”for”,”foreach”,”if”,”while” is not full selected.
  • Other cases that break the EGL language syntax.