Pitfalls
There are a couple of things to realize when starting to implement this methodology.
When we want to change what a function does, we have to check if the name still makes sense. The name of the function explains what we want to do.
If our function requires us to loop through a dataset and perform a function on each of the rows in the dataset, we cannot put all the readable functions in one place if some of the functions have to be inside the REPEAT UNTIL
loop, which is inside the function.
Since Microsoft Dynamics NAV 2013 a function name, it can contain up to 132 characters, allowing us to write functions as follows:
ForEachSalesLineCreateShipmentLineAndItemLedgerEntry.
This way, the reader understands that the function contains more than one step, and uses the Go To
Definition to further investigate. Of course, this function will also contain logical function names that make the code as readable as possible.