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”:
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.